Giter Club home page Giter Club logo

geocoding.yandex's Introduction

Geocoding.Yandex

Geocoding.net library extension for working with Yandex geocoder. Yandex geocoder works well with the geography of Russia, Ukraine, Belarus, Turkey and other close countries.

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.

Get the API key here

Installing

PM> Install-Package Yandex.Geocoding

Avaliable on NuGet

Usage Example

Simple Example

IGeocoder geocoder = new YandexGeocoder("yandex-api-key");
IEnumerable<Address> addresses = await geocoder.GeocodeAsync("Tverskaya 4");
Console.WriteLine("Formatted: " + addresses.First().FormattedAddress); //Formatted: Россия, Москва, Тверская улица, 4
Console.WriteLine("Coordinates: " + addresses.First().Coordinates.Latitude + ", " + addresses.First().Coordinates.Longitude); //Coordinates: 55,758493, 37,613198

It can also be used to return address information from latitude/longitude coordinates (aka reverse geocoding):

IGeocoder geocoder = new YandexGeocoder("yandex-api-key");
IEnumerable<Address> addresses = await geocoder.ReverseGeocodeAsync(38.8976777, -77.036517);

Using Yandex Provider Specific Data

Find address by known city

YandexGeocoder geocoder = new YandexGeocoder(ApiKey);
IEnumerable<YandexAddress> addresses = await geocoder.GeocodeAsync("Tverskaya 4");
var moscowAddress = addresses.First(address=>address.City == "Moscow");
Console.WriteLine($"Country: {moscowAddress.Country}, City: {moscowAddress.City}, Postal Code: {moscowAddress.PostCode}");

Specify response language

var geocoder = new YandexGeocoder(ApiKey)
{
  Language = Language.Turkish
};

Available languages: Russian, Belarusian, Ukrainian, Turkish, English

Specify toponym (Only for reverse geocoding)

geocoder.Kind = Kind.Metro;

Possible values: House, Street, Metro, District, Locality

Specify search boundaries

Ignored when Kind is set to District

geocoder.Bounds = new Bounds(55.542312, 37.253144, 55.933075, 37.861323);

Specify the number of addresses in response

geocoder.Results = 30;

By default - 10

Specify the number of skipped addresses

geocoder.Skip = 4;

License

This project is licensed under the MIT License - see the LICENSE file for details

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.