Link to Google maps with dynamic path - google-maps

I want to link to Google Maps with a lat & long :
For that, I Used : http://maps.google.com/maps?q=48.819141912303,2.2297863639837
I'm wondering if I can add a Path to this Google Maps ?
I used it in a static map and Can I do that with this Google maps link ?
https://maps.googleapis.com/maps/api/staticmap?path=48.819141912303,2.2297863639837|48.81863290356,2.2312122798508|48.818734654467,2.2313515376389&scale=true&size=600x300&maptype=roadmap&format=png&visual_refresh=true

I don't think that this is possible to open a map with an arbitrary polyline on it. You should use APIs for this purpose.
However, you can open the map with driving directions that pass through specified waypoints.
Just create Maps URLs for directions with origin, destination and waypoints.
For example,
https://www.google.com/maps/dir/?api=1&origin=48.819141912303,2.2297863639837&waypoints=48.81863290356,2.2312122798508&destination=48.818734654467,2.2313515376389&travelmode=walking
Have a look at Maps URLs documentation for further details.

Related

Link to Google Maps Directions using place_id

I have 2 Place IDs I've obtained via the Google Places API, and want to display a link to the Google Maps app for directions between those 2 places.
I see that it's possible to do this with 2 addresses based on the answer at Current Location - Google Maps - Link to Directions using the saddr and daddr query parameters
I also see that it's possible to link to a map with a place ID by prefixing place_id:... in the q query parameter from this answer at Getting Google Maps link from place_id
Is there a way to have a directions link with the Google place_id? I tried a URL like:
https://www.google.com/maps/dir/place_id:ChIJp4JiUCNP0xQR1JaSjpW_Hms/place_id:ChIJp4JiUCNP0xQR1JaSjpW_Hms and it doesn't seem to work
In order to open Google Maps directions mode with place IDs you have to use Google Maps URLs. The Google Maps URLs in directions mode support parameters origin_place_id and destination_place_id.
Create the following URL for example (note that origin and destination parameters are also mandatory as per documentation)
https://www.google.com/maps/dir/?api=1&origin=Yukar%C4%B1%20Bah%C3%A7elievler%2C%2070.%20Sk.%2017%2FB%2C%2006490%20%C3%87ankaya%2FAnkara%2C%20Turkey&origin_place_id=ChIJp4JiUCNP0xQR1JaSjpW_Hms&destination=Be%C5%9Fikkaya%2C%202044%2F1.%20Sk.%2C%2006230%20Alt%C4%B1nda%C4%9F%2FAnkara%2C%20Turqu%C3%ADa&destination_place_id=ChIJn-ZptRFT0xQRGUyoJX2s8Wc
Have a look at the documentation for further details.
I hope this helps!

Google Map Rates/Charges

google map pricing is highly complex. Can someone tell whether the follow will be considered as three map accesses counted for charging. I am using Javascript APIs and render maps on a mobile web app.
showing a map in the client
Geocode an address
Add a marker on the map for the given location
Reference: https://developers.google.com/maps/billing/understanding-cost-of-use
showing a map in the client using the Google Maps Javascript API v3 is a "Dynamic Maps" load (requires loading the API)
Geocode an address is a "Geocoding" access
Add a marker on the map for the given location doesn't use any additional quota

Google Maps URL Not Found

We have been using a Google Maps URL in order to get a route from two different sets of GPS coordinates.
URL:
http://maps.google.com/maps?output=dragdir&saddr=34.019283,-118.494286&daddr=34.021564,-118.490112
[Link]
We have been using this URL for months and this morning this URL is returning a 404 error. Is this URL the wrong way to retrieve a route from Google Maps?
That URL is the "classic" google maps. It might have been turned off. You will need to replace it using the Google Maps Embed API (or one of the other Google Maps APIs).

New Google maps parameters

Does anyone have a good reference for the new google maps parameters. It seems maps are now in the format
https://www.google.com/maps/#40.07304,-74.724323,8z
Where the first two parameters are the LAT and LONG, the third is the zoom level. Are there other parameters to customize such as a marker location.
Could not find any official documentation from Google, but the Moz Blog has a description on the new Google Maps URL structure.
If you want to integrate with Google Maps (instead of just providing a link to a map), Google Maps has a couple of web APIs for maps:
Google Maps Javascript API
Google Maps Embed API
Google Maps Image APIs
Those pages do describe the location format (and the API Key to be used).

Is it possible to change a route given by Google Maps

I'm writing a Google Maps mashup. I ask google the path from one location to another location. Google Maps gives me a Map with the route. I would like to take this route somehow and modify it (adding or removing points) before displaying it in the map. Is it possible? How would you do that?
Many thanks!
According to the Google Maps API Reference, there is a loadFromWaypoints function which will take waypoints in an Array and use them to calculate directions.
Edit: +1 for Cannonade. What he said.