Geospatial Pre-filtering for POI Recommendations – Data Model

In the previous blog post, we talked about using Neo4j plus a Vector Index plus H3 indexing to attempt to do some geospatial pre-filtering on the Foursquare Open Source Places (FSQ OS Places) dataset. In this post, we will discuss our data modeling strategy and how the FSQ OS Places data can be modeled as a graph. We will also show how we can model other geographies in a graph leveraging the H3 indexing approach. This will be the framework that will allow us to start querying and pre-filtering the data.

The FSQ OS Places data schema is well documented. The category dataset is a hierarchy of categories that indicate a multi-level relationship for a Place. Each place is connected to the lowest level category and then each category in turn is linked to its parent. Visually, it looks like this:

We only show a subset of the properties for both the Place of Interest (POI) node and for the Category Node.

Geospatial Knowledge Graph

Our next data model is for what I will call a Geospatial Knowledge Graph (GKG). The GKG will consist of geographical objects / features that don’t change over time. Examples would be cities with their boundaries, counties and neighborhoods. We could add in buildings, roads or other objects that have a geospatial component that we would want to search against.

For our purposes, we will primarily focus on the City but you can see that we can store H3 values at different resolutions for different geospatial nodes. We may want to have a neighborhood at a smaller resolution than a city.
In Neo4j, we will index the Hex Address property on both the POI node and on the Hex Address nodes. For a city, we can collect the set of Hex Addresses that are for that city and then do an indexed lookup to find all POIs within that city.

In order to leverage the H3 capabilities within Neo4j, we have to use an H3 plugin. This plugin provides multiple functions and procedures for working with polygons and H3 hex addresses. In our next blog post, we will show how we can combine the H3 plugin with Neo4j cypher to do the pre-filtering.

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.