Get pointlatlng from text (place)

Topics: General
Oct 21, 2011 at 11:04 AM

Ola,

I have a textbox with a place name in it: e.g. Amsterdam, Netherlands. When I click a button I want to get the poinlatlng of the city. Which parameter do I need to look into?

button1_click(....) handles button1.click
   messagebox (........)
end sub
Thanks in advance.

Oct 21, 2011 at 12:08 PM

GMapProviders.GoogleMap.GetPoint

Oct 21, 2011 at 2:26 PM

Thanks works like a charm. There is a small thing left. I read that you can use myMap.MapProvider.GetPlacemark, to "convert" it to "name", but it isn't there.

Oct 21, 2011 at 3:13 PM
Edited Oct 21, 2011 at 3:14 PM

because not every provider has implemented geocoding/etc first you need to cast it:

var g = map.MapProvider as GeocodingProvider;
if( g != null)
{
 ...

or just use exact provider, like openstreet or google:

GMapProviders.GoogleMap.GetRouteBetweenPoint/etc
GMapProviders.OpenStreetMap.GetRouteBetweenPoints...
GMapProviders.CloudMadeMap.GetRouteBetweenPoints ...