Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 28, 2026. It is now read-only.
/Geocoding.netPublic archive

C# GeoCoding / Address Validation API

License

NotificationsYou must be signed in to change notification settings

chadly/Geocoding.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

303 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Includes a model and interface for communicating with five popular Geocoding providers. Current implementations include:

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.

⚠️ There is a potential issue (#29) regarding MapQuest that has a workaround. If you would like to help fix the issue, PRs are welcome.

Installation

Installvia nuget:

Install-Package Geocoding.Core

and 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.Here

Example Usage

Simple Example

IGeocodergeocoder=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);

Using Provider-Specific Data

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.

API Keys

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

How to Build from Source

dotnet restoredotnet build

For 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.

Service Tests

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

Stars

Watchers

Forks

Packages

No packages published

Contributors29

Languages


[8]ページ先頭

©2009-2026 Movatter.jp