- Notifications
You must be signed in to change notification settings - Fork154
C# GeoCoding / Address Validation API
License
chadly/Geocoding.net
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Includes a model and interface for communicating with five popular Geocoding providers. Current implementations include:
- Google Maps -docs
- Yahoo! BOSS Geo Services -docs
- Bing Maps (aka Virtual Earth) -docs
⚠️ MapQuest(Commercial API) -docs⚠️ MapQuest(OpenStreetMap) -docs- HERE -docs
The API returns latitude/longitude coordinates and normalized address information. This can be used to perform address validation, real time mapping of user-entered addresses, distance calculations, and much more.
See latestrelease notes.
Installvia nuget:
Install-Package Geocoding.Coreand then choose which provider you want to install (or install all of them):
Install-Package Geocoding.GoogleInstall-Package Geocoding.MapQuestInstall-Package Geocoding.MicrosoftInstall-Package Geocoding.YahooInstall-Package Geocoding.HereIGeocodergeocoder=newGoogleGeocoder(){ApiKey="this-is-my-google-api-key"};IEnumerable<Address>addresses=awaitgeocoder.GeocodeAsync("1600 pennsylvania ave washington dc");Console.WriteLine("Formatted: "+addresses.First().FormattedAddress);//Formatted: 1600 Pennsylvania Ave SE, Washington, DC 20003, USAConsole.WriteLine("Coordinates: "+addresses.First().Coordinates.Latitude+", "+addresses.First().Coordinates.Longitude);//Coordinates: 38.8791981, -76.9818437
It can also be used to return address information from latitude/longitude coordinates (aka reverse geocoding):
IGeocodergeocoder=newYahooGeocoder("consumer-key","consumer-secret");IEnumerable<Address>addresses=awaitgeocoder.ReverseGeocodeAsync(38.8976777,-77.036517);
GoogleGeocodergeocoder=newGoogleGeocoder();IEnumerable<GoogleAddress>addresses=awaitgeocoder.GeocodeAsync("1600 pennsylvania ave washington dc");varcountry=addresses.Where(a=>!a.IsPartialMatch).Select(a=>a[GoogleAddressType.Country]).First();Console.WriteLine("Country: "+country.LongName+", "+country.ShortName);//Country: United States, US
The Microsoft and Yahoo implementations each provide their own address class as well,BingAddress andYahooAddress.
Googlerequires a new Server API Key to access its service.
Bingrequires an API key to access its service.
You will need aconsumer secret and consumer key (PDF) for Yahoo.
MapQuest API requires a key. Sign up here: (http://developer.mapquest.com/web/products/open)
HERE requires anapp ID and app Code
dotnet restoredotnet buildFor a nice experience, useVisual Studio Code to work with the project. The editor is cross platform and open source.
Alternatively, if you are on Windows, you can open the solution inVisual Studio and build.
You will need to generate API keys for each respective service to run the service tests. Make asettings-override.json as a copy ofsettings.json in the test project and put in your API keys. Then you should be able to run the tests.
About
C# GeoCoding / Address Validation API
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.