Skip to content

GeohashHelper

Namespace: ThinkGeo.Core

Utility methods for encoding/decoding geohashes and discovering adjacent buckets.

public static class GeohashHelper

Inheritance objectGeohashHelper

Methods

ConvertToPointShape(string)

Decodes a geohash string and returns the center point it represents.

public static PointShape ConvertToPointShape(string geohash)

Parameters

geohash string

Returns

PointShape

ConvertToGeohash(PointShape, int)

Converts the specified point into a geohash string using the requested precision.

public static string ConvertToGeohash(PointShape pointShapeInDecimalDegree, int precision)

Parameters

pointShapeInDecimalDegree PointShape
The input point using decimal degree coordinates.

precision int
The number of characters produced (defaults to 12).

Returns

string

ConvertToGeohash(Vertex, int)

Converts the specified vertex into a geohash string. See GeohashHelper.ConvertToGeohash(PointShape, int).

public static string ConvertToGeohash(Vertex vertexInDecimalDegree, int precision)

Parameters

vertexInDecimalDegree Vertex

precision int

Returns

string

ConvertToGeohash(double, double, int)

Converts a latitude/longitude pair into a geohash string.

public static string ConvertToGeohash(double latitude, double longitude, int precision)

Parameters

latitude double

longitude double

precision int

Returns

string

GetAdjacentGeohash(double, double, GeohashAjacentDirection)

Returns the geohash adjacent to the provided lat/long in the requested direction.

public static string GetAdjacentGeohash(double latitude, double longitude, GeohashAjacentDirection direction)

Parameters

latitude double

longitude double

direction GeohashAjacentDirection

Returns

string

GetAdjacentGeohash(double, double, GeohashAjacentDirection, int)

Returns the adjacent geohash using the supplied precision. See GeohashHelper.GetAdjacentGeohash(double, double, GeohashAjacentDirection).

public static string GetAdjacentGeohash(double latitude, double longitude, GeohashAjacentDirection direction, int precision)

Parameters

latitude double

longitude double

direction GeohashAjacentDirection

precision int

Returns

string

GetAdjacentGeohash(PointShape, GeohashAjacentDirection)

Returns the adjacent geohash for the provided point, inferring precision from the coordinate decimals.

public static string GetAdjacentGeohash(PointShape pointShapeInDecimalDegree, GeohashAjacentDirection direction)

Parameters

pointShapeInDecimalDegree PointShape

direction GeohashAjacentDirection

Returns

string

GetAdjacentGeohash(PointShape, GeohashAjacentDirection, int)

Returns the adjacent geohash using the supplied precision.

public static string GetAdjacentGeohash(PointShape pointShapeInDecimalDegree, GeohashAjacentDirection direction, int precision)

Parameters

pointShapeInDecimalDegree PointShape

direction GeohashAjacentDirection

precision int

Returns

string

GetAdjacentGeohash(Vertex, GeohashAjacentDirection)

Returns the adjacent geohash for the specified vertex. See GeohashHelper.GetAdjacentGeohash(PointShape, GeohashAjacentDirection).

public static string GetAdjacentGeohash(Vertex vertexInDecimalDegree, GeohashAjacentDirection direction)

Parameters

vertexInDecimalDegree Vertex

direction GeohashAjacentDirection

Returns

string

GetAdjacentGeohash(Vertex, GeohashAjacentDirection, int)

Returns the adjacent geohash using the provided precision. See GeohashHelper.GetAdjacentGeohash(double, double, GeohashAjacentDirection).

public static string GetAdjacentGeohash(Vertex vertexInDecimalDegree, GeohashAjacentDirection direction, int precision)

Parameters

vertexInDecimalDegree Vertex

direction GeohashAjacentDirection

precision int

Returns

string

GetAdjacentGeohash(string, GeohashAjacentDirection)

Returns adjacent geohash for the specified parameters.

public static string GetAdjacentGeohash(string geohash, GeohashAjacentDirection direction)

Parameters

geohash string
The geohash.

direction GeohashAjacentDirection
The rectangle that defines the area of interest.

Returns

string
A string result.

GetAdjacentGeohashes(string)

Returns the eight neighboring geohashes surrounding the supplied hash.

public static Collection<string> GetAdjacentGeohashes(string geohash)

Parameters

geohash string

Returns

Collection<string>

GetAdjacentGeohashes(PointShape)

Returns the eight neighboring geohashes for the specified point, inferring precision from the coordinate decimals.

public static Collection<string> GetAdjacentGeohashes(PointShape pointShapeInDecimalDegree)

Parameters

pointShapeInDecimalDegree PointShape

Returns

Collection<string>

GetAdjacentGeohashes(PointShape, int)

Returns the adjacent geohashes using the supplied precision.

public static Collection<string> GetAdjacentGeohashes(PointShape pointShapeInDecimalDegree, int precision)

Parameters

pointShapeInDecimalDegree PointShape

precision int

Returns

Collection<string>

GetAdjacentGeohashes(Vertex)

Returns the adjacent geohashes around the provided vertex. See GeohashHelper.GetAdjacentGeohashes(string).

public static Collection<string> GetAdjacentGeohashes(Vertex vertexInDecimalDegree)

Parameters

vertexInDecimalDegree Vertex

Returns

Collection<string>

GetAdjacentGeohashes(Vertex, int)

Returns the adjacent geohashes around the provided vertex using the supplied precision.

public static Collection<string> GetAdjacentGeohashes(Vertex vertexInDecimalDegree, int precision)

Parameters

vertexInDecimalDegree Vertex

precision int

Returns

Collection<string>

GetAdjacentGeohashes(double, double)

Returns the adjacent geohashes around the supplied latitude/longitude pair.

public static Collection<string> GetAdjacentGeohashes(double latitude, double longitude)

Parameters

latitude double

longitude double

Returns

Collection<string>

GetAdjacentGeohashes(double, double, int)

Returns the adjacent geohashes around the supplied latitude/longitude pair using the specified precision.

public static Collection<string> GetAdjacentGeohashes(double latitude, double longitude, int precision)

Parameters

latitude double

longitude double

precision int

Returns

Collection<string>