How to get the geocode of a specific location by tapping on the map UWP C# - event-handling

I went through lot of tutorials which states how to add a mapicon a pushpin on to a map, but all of them require me to hard code the latitude and the longitude or give the address in a text form.
But what i want is to get the geocode (lat and lon values) of any place when and where the user double tap on the map.
Adding a pushpin there is required too.
i am not using bing maps api, using services.maps, Devices.geolocation, map control and other uwp map functionalities only.

What you need to handle is the MapTapped of the MapControl event to get the geolocation of the place where the pointer is tapped. Something like this would do:
private void MyMap_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
{
var tappedGeoPosition = args.Location.Position;
//Do something
}
Check out these official samples on GitHub

Related

Bing Maps API Web Control, Which directions are selected?

Using the bing maps API Web Control v8's DirectionsManager, how can I tell which directions have been selected if there are multiple routes displayed? Is there an event that I can't seem to find? Or maybe something that I can get from the directionsManager object?
Thanks!
Use the update event and the getCurrentRoute function:
Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', function () {
var currentRoute = directionsManager.getCurrentRoute();
//This will be the currently displayed route. This will fire after a route calculation or when you select an alternate route option.
});

How can I access a pushpin already added on the map later with the help of some ID? (Bing maps V8)

I have a map where I have added many pushpins & have attached an id with each one of them.
Now, there's a listing of these locations on the right hand in list, I want to highlight a particular pin on click of it's corresponding listing. How do I access these pushpins with the help of id?
I simply want to do something like this: (This is just a random pseudocode, not an actual function)
var e=Microsoft.maps.getPushpin(someID);
Take a look at this code sample. It should how to create a list based on pushpin data and link it back to the pushpins themselves using an id: http://bingmapsv8samples.azurewebsites.net/#QueryAPI_Paging
Source Code: https://github.com/Microsoft/BingMapsV8CodeSamples/blob/master/Samples/Spatial%20Data%20Services/QueryAPI_Paging.html

Google maps how to keep infoWindow open when marker coordinates change

I currently have a marker on the map using google map. I want to keep the infoWindow visible until the user tap elsewhere. The issue is that it work as it should when the user is coords do not change but whenever the user drive and coord change the info window disappear immediately. I would like to keep the info window there even if the marker move away from. Thank you in advance for the help
first make info window object
var infowindow = new google.maps.InfoWindow({
content: "Hello World"
});
then make latlng object containing latlng and setposition of infowindow
infowindow.setPosition(new google.maps.LatLng(19.243750,73.149095))
then open on map
infowindow.open(map)

Get latitude and longitude for map click

Can anybody tell me that how can I get latitude and longitude of a location when clicking on map?
You could try changing this to suite your needs:
http://www.iphonedevsdk.com/forum/tutorial-discussion/39374-mkmapview-tutorial-using-latitude-longitude.html
Try google maps v3 api. Add an event listener to click and you can get latitide/longitude pretty easily. Ex:
google.maps.event.addListener(map, 'click', function(event) {
YourHandler(event.latLng);
});
event.latLng automatically gets the longitude and latitude of the location you clicked on

Create a pin (with heading and description for Google Maps) which is available for routes

I want to start the Maps application from my app. A pin with a correct heading and description (Address) should be shown on the Google map. Ideally the user should pick up this location and use it for a navigation.
I tried this:
1) http://maps.google.com/maps?ll=-33.874559,151.219575
Problem: No pin is shown on the map. The user can add a pin (it is automatically positioned on my before given location) and he can make a navigation etc. If the user has added the pin, he sees the correct address.
2) http://maps.google.com/maps?q=This+is+near+Lake+Shore+Drive#41.9288,-87.6315
Problem: Pin is shown on the map with a given heading. If the user taps the pin, he can't see the address (only latitude, longitude). If the user adds a pin (like in the example before) the position is somewhere in around my given location, but not there where I want. The user has to adjust the position by himself and than he can make a navigation to this point.
3) http://maps.google.com/maps?q=1+Infinite+Loop+Cupertino,CA+95014,USA+(somewhere)
Now I have a heading and a description field. The problem here is that the description is taking account and then there are ten pins shown (which contains a keyword from my description) instead of one.
Other possibilities:
4) Use of a kml-file
I don't want to store many kml-files somewhere on a server. Ideally some URL parameters for creating a kml-file would be fine. But I think there is no way for doing that.
5) Use of MapKit
If I would use MapKit I could create my own pin headings and descriptions. But there is nothing for the navigation I think.
Are there any other suggestions?
I made a combination of MapKit and Google Maps.