Index and Querying

The current index is an RTree index, but it has been developed in an extensible way allowing for other indices to be added if necessary.

Loading and Indexing

It is possible to load data into the database and add it to the index during the load. It is also possible to add existing spatial data to the index later. These are two very different scenarios, and in fact can lead to different graph structures, so we will explain them each in turn.

To load data directly into the index, the simplest approach is to start by creating a Layer that suites your data. There are many possible choices built into Neo4j-Spatial, but two common ones would be:

  • SimplePointLayer - an editable layer that allows you to add only Points to the database. This is a good choice if you only have point data and are interested primarily in proximity searches. This layer includes utility methods specifically for that case.

  • EditableLayer(Impl) - this is the default editable layer implementation and can handle any type of simple geometry. This includes Point, LineString and Polygon, as well as Multi-Point, Multi-LineString and Multi-Polygon. Since it is a generic implementation and cannot know about the topology of your data model, it stores each geometry separately in a single property of a single node. The storage format is WKB, or 'Well Known Binary', which is a binary format specific to geographic geometries, and also used by the popular open source spatial database PostGIS.