Neo4j – GeoParquet

Over the 2023 holidays, I wanted to learn more about GeoParquet and learn more about geospatial data in general. I decided to create a simple Neo4j plugin that reads in a Geoparquet file (or any parquet file for that matter) and return the results to the user. This is similar to the capability in the APOC-Extended library although my plugin adds the GeoParquet capability. The idea is to take that data and pass it to the Neo4j H3 plugin for additional processing.

The initial code base is here. Let’s look at some examples on how this works. First we will use a GeoParquet file of the US Counties.


Our code block looks like this:

call com.neo4jparquet.readParquetWKT("/var/lib/neo4j/import/county.parquet") yield value 
return value limit 2;

and the result looks like this:

In this case we use the com.neo4jparquet.readParquetWKT to get the geometry in a WKT format. You can see the key value pairs that are returned.

If we choose to return the Polygon as a list, we can pass it into an H3 procedure to return the number of H3 rings at resolution 10.

call com.neo4jparquet.readParquet("/var/lib/neo4j/import/county.parquet") yield value 
with value where value.STATE_NAME = 'South Dakota'
    AND value.NAMELSAD = 'Charles Mix County'
call com.neo4jh3.polygonToCells(value.Geometry,[],10,'lonlat') yield value as h3
return count(h3)

and the results look like this:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.