Importing .shp file in Sand Box

Hi all,

When I run

CALLspatial.importShapefileToLayer('geom','gs://dse203_group_project/Data/cb_2021_06_tract_500k/cb_2021_06_tract_500k.shp') I get the error that

There is no procedure with the name `spatial.importShapefileToLayer` registered for this database instance

I tried using Sand Box with Graph Data Science and then deleting data and same with OSM. Neither had Spatial. It's been hard finding an actual terminal window to add Spatial as a clone from git, and I'm not sure if that would even work. I'm using Sand Box because we have a google bucket where we're storing data. I'm trying to upload census tract shape files.

Hi @James7 -

The spatial plugin that you mention is a community project and not something that is included in Neo4j Sandbox. In order to use that plugin you'd need to install it on a local Neo4j download or a self-managed instance. It's also important to point out that there is not a recent release of the spatial plugin for Neo4j 5.

Another approach would be to convert your shape file(s) to GeoJSON using a tool like gdal's ogr2ogr CLI and then use apoc.load.json to import into Neo4j. (Or perhaps the source data is also available as GeoJSON?)

Here's an example looking at real estate / cadastral data:

ogr2ogr gallatin.geojson -f "GeoJSON" -lco id_field=PARCELID -t_srs "EPSG:4326" GallatinOwnerParcel_shp.shp

Then in Cypher:

CALL apoc.load.json("file:///gallatin.geojson") YIELD value
FOREACH (feat IN  value.features |
    MERGE (p:Property {id: feat.id})
    SET p += feat.properties
)

You can find more code for working with that dataset on GitHub here.