Unable to load shapefile using neo4j spatial plugin

Running neo4j desktop 4.2.3, Spatial 0.28.0-neo4j-4.2.3
config files have been updated to ensure spatial.* procedures are available.

I've attempted the following procedure call (in multiple variations) and continue to receive the following error:

The file is stored inside a directory in my neo4j import folder. I have also attempted to load the file from other locations on my hard drive.

I'm sure I'm making some kind of rookie error, but can't seem to figure it out.

Looking at the test code at spatial/SpatialProceduresTest.java at master ยท neo4j-contrib/spatial ยท GitHub

It would seem that the path is relative to the working directory of the process, and does not support any URI syntax. This means I believe you need to type:

CALL spatial.importShapefileToLayer('geom','import/shapeFiles/tl_2017_48_place.shp')

Try this out, and if it does not work, I can try some local tests to see what the issue is.

1 Like

Just tried this. Got the same result. Is there any additional information from me that would be helpful?

I just installed a recent version of Neo4j 4.2 and tried this and it worked. Could it be that you are missing parts of the shapefile? Note that shapefiles are not single files but a small set of files. For example, the command I ran was:

CALL spatial.addWKTLayer('geom','geom');
CALL spatial.importShapefileToLayer('geom','import/shapeFiles/highway.shp')

And this returned the result:

โ•’โ•โ•โ•โ•โ•โ•โ•โ••
โ”‚"count"โ”‚
โ•žโ•โ•โ•โ•โ•โ•โ•โ•ก
โ”‚143    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Which means it loaded 143 geometries.

And what I have in my import/shapeFilesdirectory is:

-rw-rw-r-- 1 craig craig 872672 nov 23 19:17 highway.dbf
-rw-rw-r-- 1 craig craig   1729 nov 23 19:17 highway.fix
-rw-rw-r-- 1 craig craig    212 nov 23 19:17 highway.prj
-rw-rw-r-- 1 craig craig   5208 nov 23 19:17 highway.qix
-rw-rw-r-- 1 craig craig  33212 nov 23 19:17 highway.shp
-rw-rw-r-- 1 craig craig   1244 nov 23 19:17 highway.shx

Can you list the contents of your import/shapeFiles directory, and we can compare?

It looks like we have .dbf, .prj, .shp, .shx in common. I also have a .cpg, 3 .xml files. However, I am missing a .fix and .qix file.

Is there a standard for what file types are required to make a "complete" Shapefile?

I think the shapefile standard has evolved over time. But we are using geotools 24.2, which is quite recent and should understand all versions of the shapefile. Could you zip up all the tl_2017_48_place.* files and attach them, so I can try import this exact shapefile locally?

I also notice that you have a directory named tl_2017_48_place containing the files also named tl_2017_48_place.*. So the original import statement should in fact be:

CALL spatial.importShapefileToLayer('geom','import/shapeFiles/tl_2017_48_place/tl_2017_48_place.shp')

Unfortunately the file extension.zip can't be uploaded. I sourced the file from here: https://www2.census.gov/geo/tiger/TIGER2021/

Also, I tried the updated CALL you posted and continued to get the same error.

You could just rename the file to something else, and I'll rename it back to zip. Otherwise email it directly to me.