This is a migrated thread and some comments may be shown as answers.

Geo Coding

4 Answers 69 Views
Map
This is a migrated thread and some comments may be shown as answers.
Darren Stoppler
Top achievements
Rank 1
Darren Stoppler asked on 25 May 2010, 02:21 PM
Does anyone know the best way to get latitude and longitued information for a given address for OpenStreetMaps?

Thanks

4 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 28 May 2010, 11:40 AM
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.
0
Darren Stoppler
Top achievements
Rank 1
answered on 28 May 2010, 11:42 AM
Hi Andrey,

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

Thanks for your reply.

Darren
0
Andrey
Telerik team
answered on 28 May 2010, 04:03 PM
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.
0
Darren Stoppler
Top achievements
Rank 1
answered on 28 May 2010, 04:05 PM
Thank you Andrey.  This example is very helpful.
Tags
Map
Asked by
Darren Stoppler
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Darren Stoppler
Top achievements
Rank 1
Share this question
or