Skip to content

Necrolis/GeoSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoSharp

An offline Geocoding library for .Net coded in C#. Based on the awesome Java lib by AReallyGoodName: https://github.com/AReallyGoodName/OfflineReverseGeocode You may also be interested in https://github.com/RobThree/NGeoNames (also under MIT).

Requirements

  • This library is built for .Net 4, however it should work fine with 3.5 and Mono.
  • The data that is fed in needs to be in the geoname format as described here.
  • Here you'll find various sets of formatted data to use for the reverse geocoding.

Performance

The look ups are very fast, O(logn), however building the initial KD-Tree is not so fast, O(kn * logn), so pre-selecting your datasets and filtering out places or areas that are not of interest (like water bodies) can be used to improve load speed and reduce memory usage.

Filtering of data can be done offline using the GeoDBOptimize class to create tailored geoname tables.

Usage

Load a database from a file

GeoSharp.ReverseGeoCode geocode = new GeoSharp.ReverseGeoCode(@"C:\allCountries.txt", true);
Console.WriteLine(geocode.NearestPlaceName(40.730885, -73.997383));

Load a database from a Stream

using (MemoryStream ms = new MemoryStream(MemoryDB))
{
	GeoSharp.ReverseGeoCode geocode = new GeoSharp.ReverseGeoCode(ms, true);
	Console.WriteLine(geocode.NearestPlaceName(40.730885, -73.997383));
}

License

Licensed under The MIT License.

About

An offline Geocoding library for C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages