Reputation: 595
i want to know, if there is any possibility to find out the geoCoordinate from a specific location. I have the following code:
delMap.Heading = 0;
delMap.CartographicMode = MapCartographicMode.Road;
delMap.LandmarksEnabled = true;
delMap.ZoomLevel = 8;
delMap.Center = new GeoCoordinate(47.6097, -122.3331);
MapOverlay overlay = new MapOverlay
{
GeoCoordinate = delMap.Center,
Content = new Ellipse
{
Fill = new SolidColorBrush(Colors.Red),
Width = 10,
Height = 10
}
};
MapLayer layer = new MapLayer();
layer.Add(overlay);
delMap.Layers.Add(layer);
it displays a point at the delmap.Center location, just as expectet. But now, i need to find out how to center the map, if i only know the name of the geographic location. For instance "New York".
Upvotes: 0
Views: 207
Reputation: 7112
Map has no concept of "New York", you can only center it at geographic coordinates. You need to get the coordinates for a given location.
To do that, either build a list of coordinates for locations (if you have a limited and known number of location) using Google or Bing maps or find a web service that will give you a coordinate for a given name.
EDIT: What you need is geocoding. Here is the Google API reference: https://developers.google.com/maps/documentation/geocoding/.
Upvotes: 1