问题
Anybody know how to create a proper URL to link to here.com
maps, from my site? We use an extensive amount of API calls to embed the maps inside our site, but I want to send emails to people with a 'Click Here for directions'
link inside pointing to here.com
driving directions with the address or coordinates built into the URL.
Example:
With Google Maps, all we would have to do is make a simple link like this:
https://www.google.com/maps?saddr=32.5589671,-97.2586011&daddr=32.7787855,-97.4495476
Just pass along the variables saddr
and daddr
within the URL. I've tried everything to build a proper URL for here.com
maps and it doesn't process it properly.
My best attempt was:
https://www.here.com/directions/drive/32.2589671,-97.4486011/Weatherford,_Texas?x=ep&map=30.38114,-89.89326,6,normal
But it does not process this URL properly and now I'm pretty much stuck, since I have tried everything that I know to try.
回答1:
Something like https://www.here.com/directions/drive/start:lat1,lng1/end:lat2,lng2 seems to work.
- The text before the colon provides the text of the start/end location
- There should be absolutely no spaces between the latitude and longitude
- If no
map
parameter is added, the map view defaults to show the whole route on a street map - If a
map
parameter of the form?map=lat,lng,zoom,maptype
is added, the map initially shows the map view specified, then moves to show the whole route - like this satellite map link
I've checked that the first link (without the map
parameter) also works on a Windows Phone to forward to the HERE Maps app if it is installed. I've not tested what happens if the Android or iOS HERE Maps apps are installed on mobile. If the HERE Maps app is not present on a mobile, the site should forward to the m.here.com mobile friendly site.
Other endpoints will vary by device - the following are fine on tablets:
- Parisian Restaurants
https://www.here.com/discover/restaurant?map=48.85,2.35,15,normal
- New York Traffic
https://www.here.com/traffic/explore?map=40.7127,-74,15,normal
来源:https://stackoverflow.com/questions/27762364/create-url-to-here-com-maps-driving-directions-with-addresses-coordinates-passed