Skip to content

andrerav/Geohash.SpatialIndex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geohash.SpatialIndex

Download

Package Link
Geohash.SpatialIndex.Core image
Geohash.SpatialIndex.SpatialRelations image

Quickstart

Build the index:

var index = new GeohashSpatialIndex<int>(
                  new DefaultGeohasher(), 
                  new DefaultTrieMap<int>(), 
                  precision: 9);

Fill the index with geometries:

foreach(var obj in gisObjects)
    index.Insert(obj.Geometry, obj);

Query the index:

var result = index.Query(geom)

You can also use one of the provided spatial relation functions provided which is backed by NetTopologySuite:

var relations = new GeohashSpatialIndexRelations<MyGisObjType>(index);
var result = relations.STIntersects(myGeom);

Description

A spatial index backed by geohashing and Trie (prefix tree) maps. Geometries are encoded as geohashes and stored in a prefix tree, and reverse lookups are performing by encoding the queried geometry and using the prefix tree as an inverted lookup index. The index size can be tuned with the precision parameter. The geohasher and prefix tree map providers can be injected by implementing the IGeohasher and/or IGeohashTrieMap<TEntryList, T> interfaces. This library ships with default implementations that uses rm.Trie and geohash-dotnet.

Below is an example with an index covering a set of polygons along the norwegian coastline:

image

Another example, an index covering some polygons in inner Oslo Fjord:

image

A final example, some polygons related to offshore installations in the north sea:

image

About

A spatial index backed by geohashing and trie maps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published