Geo Coding

5 posts, 0 answers
  1. Darren Stoppler
    Darren Stoppler avatar
    36 posts
    Member since:
    Apr 2010

    Posted 25 May 2010 Link to this post

    Does anyone know the best way to get latitude and longitued information for a given address for OpenStreetMaps?

    Thanks
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 28 May 2010 Link to this post

    Hi Darren,

    OpenStreetMaps does not expose geocoding / routing services support. You can use OpenStreet map provider with the BingMaps geocoding / routing.

    Best wishes,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Darren Stoppler
    Darren Stoppler avatar
    36 posts
    Member since:
    Apr 2010

    Posted 28 May 2010 Link to this post

    Hi Andrey,

    Does Microsoft charge for this?  Also, are there any code examples for this.

    Thanks for your reply.

    Darren
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 28 May 2010 Link to this post

    Hi Darren,

    You should retrieve a Bing Maps key before using BingMaps Services. Find the details in this article.
    The following sample code uses this key in BingApplicationId for assigning this.geoProvider.ApplicationId property:
    private BingGeocodeProvider geoProvider;

    // initialize BingGeocodeProvider
    private void InitGeoProvider()
    {
        this.geoProvider = new BingGeocodeProvider();
        this.geoProvider.ApplicationId = BingApplicationId;
        this.geoProvider.MapControl = radMap;
        this.geoProvider.GeocodeCompleted += new EventHandler<GeocodeCompletedEventArgs>(geoProvider_GeocodeCompleted);
    }

    private
    void Button_Click(object sender, RoutedEventArgs e)
    {
        GeocodeRequest request = new GeocodeRequest();
        request.Query = this.textbox1.Text;

        
    // start geocode request
        this.geoProvider.GeocodeAsync(request);
    }

    // request complete
    private void geoProvider_GeocodeCompleted(object sender, GeocodeCompletedEventArgs e)
    {
        if (e.Response.Results != null && e.Response.Results.Count > 0)
        {
            Location location = e.Response.Results[0].Locations[0];

            
    // Show object according to found location
        }
    }

    Sincerely yours,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Darren Stoppler
    Darren Stoppler avatar
    36 posts
    Member since:
    Apr 2010

    Posted 28 May 2010 Link to this post

    Thank you Andrey.  This example is very helpful.
Back to Top
DevCraft banner