1
I need to create a route on the Windows Phone map. The starting place is the location of the phone, which I capture by the classes Geolocator and Geoposition. The place of arrival is an already premeditated address, but will not be in coordinates (Example: "Avenida Recife, Pernambuco"). In order to enter it in the method to create the route, the address must be in coordinates and I cannot find a way to perform this conversion.
Here’s an example of how I’m doing this route:
async void ObterLocalizacaoAsync(double latitude, double longitude)
{
Geolocator localizacao = new Geolocator();
localizacao.DesiredAccuracy = PositionAccuracy.High;
Geoposition posicao = await localizacao.GetGeopositionAsync();
latitude = posicao.Coordinate.Latitude;
longitude = posicao.Coordinate.Longitude;
}
void appRotaButton_Click(object sender, EventArgs e)
{
ObterLocalizacaoAsync(latitude, longitude);
MapsDirectionsTask rota = new MapsDirectionsTask();
rota.Start = new LabeledMapLocation("Sua posição", new GeoCoordinate(latitude, longitude));
rota.End = new LabeledMapLocation("Posição final", <coordenada-do-endereco>);
rota.Show();
}
You can get the coordinates from another app like Google Maps. For example, if you search for Avenida Recife at GM you will find the following URL: https://www.google.com/maps/place/Avenida+Recife/@-8.1201743,-34.9202733,17z/data=! 3m1! 4b1! 4m2! 3m1! 1s0x7ab1e95eecb6f7b:0x9b1d8bb39ab28ea3. Values -8.1201743,-34.9202733 are latitude and longitude.
– Vinicius Rocha
If the user is going to do a textual search by destination on the phone itself, we can use some map component and read these coordinates from the component itself. http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207045(v=vs.105). aspx or http://developer.nokia.com/resources/library/Lumia/maps-and-navigation/guide-to-the-wp8-maps-api.html
– Vinicius Rocha
Did you find a solution? Poste as an answer to help other people.
– Maniero
I think this link answers your question http://www.braincastexception.com/wp7-web-services-first-part-geocodeservice/
– Marco Antonio Quintal