Class GeoHash
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Inheritance
System.Object
GeoHash
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Common
Assembly: Mars.Common.dll
Syntax
public static class GeoHash
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
Methods
| Improve this Doc View SourceBboxes(Double, Double, Double, Double, Int32)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static IEnumerable<string> Bboxes(double minLat, double minLon, double maxLat, double maxLon, int numberOfChars = 9)
Parameters
Type | Name | Description |
---|---|---|
System.Double | minLat | |
System.Double | minLon | |
System.Double | maxLat | |
System.Double | maxLon | |
System.Int32 | numberOfChars |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
BboxesInt(in Double, in Double, in Double, in Double, in Int32)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static long[] BboxesInt(in double minLat, in double minLon, in double maxLat, in double maxLon, in int bitDepth = 52)
Parameters
Type | Name | Description |
---|---|---|
System.Double | minLat | |
System.Double | minLon | |
System.Double | maxLat | |
System.Double | maxLon | |
System.Int32 | bitDepth |
Returns
Type | Description |
---|---|
System.Int64[] |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
Decode(in String)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static GeohashDecodeResult Decode(in string hashString)
Parameters
Type | Name | Description |
---|---|---|
System.String | hashString |
Returns
Type | Description |
---|---|
GeohashDecodeResult |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
DecodeBbox(in String)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static BoundingBox DecodeBbox(in string hashString)
Parameters
Type | Name | Description |
---|---|---|
System.String | hashString |
Returns
Type | Description |
---|---|
BoundingBox |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
DecodeBboxInt(in Int64, in Int32)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static BoundingBox DecodeBboxInt(in long hashInt, in int bitDepth = 52)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | hashInt | |
System.Int32 | bitDepth |
Returns
Type | Description |
---|---|
BoundingBox |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
DecodeInt(in Int64, in Int32)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static GeohashDecodeResult DecodeInt(in long hashInt, in int bitDepth = 52)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | hashInt | |
System.Int32 | bitDepth |
Returns
Type | Description |
---|---|
GeohashDecodeResult |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
Encode(Double, Double, in Int32)
Converts the input geo-coordinate described by longitude, latitude into a GeoHash string.
Declaration
public static string Encode(double longitude, double latitude, in int precision = 9)
Parameters
Type | Name | Description |
---|---|---|
System.Double | longitude | The x/longitude component of the coordinate. |
System.Double | latitude | The y/latitude component of the coordinate. |
System.Int32 | precision | The amount of bits to take into calculation to reduce or increase the error prone (GeoHashPrecision. |
Returns
Type | Description |
---|---|
System.String | Returns the GeoHash as a string representing the specified geo-coordinate |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
EncodeInt(Double, Double, Int32)
Converts the input geo-coordinate described by longitude, latitude into a geohash integer.
Declaration
public static long EncodeInt(double latitude, double longitude, int precision = 52)
Parameters
Type | Name | Description |
---|---|---|
System.Double | latitude | The y/latitude component of the coordinate. |
System.Double | longitude | The x/longitude component of the coordinate. |
System.Int32 | precision | The amount of bits to take into calculation to reduce or increase the error prone (GeoHashPrecision. |
Returns
Type | Description |
---|---|
System.Int64 | Returns the GeoHash as an integer representing the specified geo-coordinate. |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
EncodeNeighbor(Int32, Int32, Int32, GeohashDecodeResult)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static string EncodeNeighbor(int hashstringLength, int neighborLatDir, int neighborLonDir, GeohashDecodeResult coords)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | hashstringLength | |
System.Int32 | neighborLatDir | |
System.Int32 | neighborLonDir | |
GeohashDecodeResult | coords |
Returns
Type | Description |
---|---|
System.String |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
EncodeNeighborInt(in Int32, in Int32, GeohashDecodeResult, Int32)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static long EncodeNeighborInt(in int neighborLatDir, in int neighborLonDir, GeohashDecodeResult coords, int bitDepth)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | neighborLatDir | |
System.Int32 | neighborLonDir | |
GeohashDecodeResult | coords | |
System.Int32 | bitDepth |
Returns
Type | Description |
---|---|
System.Int64 |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
GetNextGreaterPrecision(Double)
Gets the nearest next greater precision for a given cell size
Declaration
public static GeoHashPrecision GetNextGreaterPrecision(double cellSizeInMeter)
Parameters
Type | Name | Description |
---|---|---|
System.Double | cellSizeInMeter | The cell size in meter |
Returns
Type | Description |
---|---|
GeoHashPrecision |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
Neighbor(in String, in Int32[])
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static string Neighbor(in string hashString, in int[] direction)
Parameters
Type | Name | Description |
---|---|---|
System.String | hashString | |
System.Int32[] | direction |
Returns
Type | Description |
---|---|
System.String |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
NeighborInt(in Int64, in Int32[], in Int32)
Find neighbor of a geo-hash integer in certain direction. Direction is a two-element array, i.e. [1,0] means north,
[-1,-1] means southwest.
direction [lat, lon], i.e.
[1,0] - north
[1,1] - northeast ...
Declaration
public static long NeighborInt(in long hashInt, in int[] direction, in int bitDepth = 52)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | hashInt | The numeric hash of the neighbour in the desired direction. |
System.Int32[] | direction | The direction to hash |
System.Int32 | bitDepth | The precision |
Returns
Type | Description |
---|---|
System.Int64 |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
Neighbors(String)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static string[] Neighbors(string hashString)
Parameters
Type | Name | Description |
---|---|---|
System.String | hashString |
Returns
Type | Description |
---|---|
System.String[] |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.
|
Improve this Doc
View Source
NeighborsInt(Int64, Int32)
Provides function to encode/decode geo coordinates into and from GeoHash
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer
which encodes a geographic location into a short string of letters and digits.
It is a hierarchical spatial data structure which subdivides space into buckets of grid shape,
which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Declaration
public static long[] NeighborsInt(long hashInt, int bitDepth = 52)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | hashInt | |
System.Int32 | bitDepth |
Returns
Type | Description |
---|---|
System.Int64[] |
Remarks
Geohashes offer properties like arbitrary precision and the possibility of gradually removing
characters from the end of the code to reduce its size (and gradually lose precision).
Geohashing guarantees that the longer a shared prefix between two geohashes is,
the spatially closer they are together. The reverse of this is not guaranteed,
as two points can be very close but have a short or no shared prefix.