Skip to content

dasarghya33/geohash-dotnet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geohash-dotnet

Easy-to-use and feature-rich geohash library

NuGet version (blazor-dragdrop)

Build Status

Demo

https://geohash.azurewebsites.net/

Installation

To use the geohash library in your projects run the following command in the Package Manager Console:

 Install-Package geohash-dotnet

Usage Examples

Create a Geohasher object

var hasher = new Geohasher();

Encode a latitude and longitude to a geohash

   var hash  = hasher.Encode(52.5174, 13.409);  // default precision 6 
   var hash2 = hasher.Encode(52.5174, 13.409, 12);  // precision 12

Decode a geohash to latitude and longitude

    var decoded = hasher.Decode("u33dc0");
    var latitude = decoded.Item1;
    var longitude = decoded.Item2;

Get neighbors for a hash

    var neighbors         = hasher.GetNeighbors("m");
    var northNeighbor     = neighbors[Direction.North];
    var northEastNeighbor = neighbors[Direction.NorthEast]);
    var eastNeighbor      = neighbors[Direction.East]);
    var southEastNeighbor = neighbors[Direction.SouthEast]);
    var southNeighbor     = neighbors[Direction.South]);
    var southWestNeighbor = neighbors[Direction.SouthWest]);
    var westNeighbor      = neighbors[Direction.West]);
    var northWestNeighbor = neighbors[Direction.NorthWest]);

Get specific neighbor for a hash

var southEastNeighbor = hasher.GetNeighbor("u33dc0", Direction.SouthEast));

Get all 32 subhashes for a hash

var subhashes = hasher.GetSubhashes("u33dc0");

Get parent of a hash

var parentHash = hasher.GetParent("u33dbc")

About

Easy-to-use and feature-rich geohash library written in C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%