Skip to content

Pooch11/GeneGenie.Geocoder

 
 

Repository files navigation

GeneGenie.Geocoder

A .Net standard geocoder library that can query multiple backend geocoders and rotate between them (briefly named Neocoder, GeneGenie.Geocoder is the new name for the project).

Currently supports Google and Bing geocoder APIs.

Status

AppVeyor branch NuGet AppVeyor tests

Quickstart

See the GeneGenie.Geocoder.Console project for an example of the following. Set your Google and Bing geocoder API keys in appsettings.json. Register the geocoder for use with .Net Core Dependency Injection via;

        // This gets the geocoder settings out of your configuration file.
        var appSettings = configuration.GetSection("App").Get<AppSettings>();

        // Register the settings and Neocoder.
        return new ServiceCollection()
            .AddSingleton(appSettings.GeocoderSettings)
            .AddGeocoders()
            .BuildServiceProvider();

In your main code

            // Normally you'd get this injected via DI.
            var geocodeManager = serviceProvider.GetRequiredService<GeocodeManager>();

            var geocoded = await geocodeManager.GeocodeAddressAsync(address);

Running multiple instances

If using this library in a multi-process environment (such as serverless functions or a webfarm) then you'll need to implement your own Geocoder selector with the interface IGeocoderSelector. The class you implement would need to figure out what geocoder to select next based on what was used previously by accessing a shared resource (Redis, database layer etc), This would typically involve a locking fetch / update on the resource. See InMemoryGeocoderSelector.cs for ideas.

Code quality

Maintainability Quality gate Bugs Vulnerabilities Code smells Coverage Duplications Reliability Security Security Lines of code

Build stats

Contributing

We would love your help, see Contributing.md for guidelines.

About

Geocoder for .Net Standard that uses multiple backend geocoder services.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.6%
  • Batchfile 0.4%