Google Static Map - google-maps

I need to use Google Static Map api, but I need to give it from (latitude, longitude) to (latitude, longitude) and show maps between those two places
can anyone support in this part please
I'm using this code this get map of one place
http://maps.google.com/staticmap?center=30.0566,31.2262&format=png32&zoom=10&size=360x602
but I want to get the map between two places
from : 30.0566,31.2262
to : 25.6969,32.6422
Thanks in Advance

Google Static Maps does not support driving directions. However it does support drawing lines, including encoded polylines. Everything is subject to the maximum length of a URL (2048 characters).
This means you can use the Directions API server-side, extract the encoded polyline from the results and construct the Static Maps URL using the line.
Documentation for the Directions API

Related

Link to Google maps with dynamic path

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.

How can i generate Walking or Driving static google map

I am trying to create a google map using the static google map API. I want walking and driving static map.
Bellow is the path i am using :
http://maps.google.com/maps/api/staticmap?maptype=roadmap&zoom=14&size=400x250&markers=color:green|label:A|30.7261629,76.7596221&markers=color:red|label:B|30.7226447,76.7681678&path=color:0xff0000ff|weight:3|30.7261629,76.7596221|30.7226447,76.7681678&sensor=false
Static map api support only marker not direction.
If you want to use direction with Static map, you need to use direction api.
How to do: how to create a static api map with directions
Basically what the up-voted answer is saying:
1. Use direction api to get encoded path.
2. In static map use this encoded path.

Is it possible to put a location marker on a google map without requesting it from the google server?

Really quick/simple question that will determine which map API i use for my project.
I dont need an example- ill figure that out, i just need to know if the capabilities are there.
If i have store geocode (latitude, longitude) coordinates in a database, can i put one of those little red markers on a google map without having to actually make a geocoding request from google?
Additional question:
Also, would it count towards any quotas every time i display one of their maps, even if i give them the geocoded coordinates? Because i mean technically their map still has to find those coordinates...
Q1: Yes — you tell the API the coordinates of where to put the marker, rather than get Google to find those coordinates.
Q2: The usage limits are published by Google. You can have up to 25000 map loads per day. If you don't use the geocoder because you provide the coordinates yourself, then you don't use a geocoder access.

Get latitude and longitude points in Google Maps polyline

I want to draw Polylines with the Google Maps JavaScript API. Is there a tool that will help me get the latitude and longitude points by just clicking on the map, then exporting an array of lat-long pairs?
I imagine something like the personalized maps service (My Places) in Google Maps where you can click-snap on the roads to specify your own driving directions. I'd like to take that one step further. That is, to export an array of lat-long pairs that specify the roads traveled.
I know this answer might be a little late but today I was trying to figure out what I believe to be the same issue as this question. So, you can draw the points on the map then get that encoded polyline with Google's Interactive Polyline Encoder Utility then I recommend using Mapbox polyline utility to convert the overview_polyline to latitude and longitude pairs values. The latitude and longitude pairs are also on Googles Utility but it is a bit of a hassle to continuously copy each coordinate.
For more information about the Mapbox Polyline Utility process:
http://zevross.com/blog/2014/09/23/convert-google-directions-to-geojson-points-or-polylines/
And here is Google's Encoder Utility:
https://developers.google.com/maps/documentation/utilities/polylineutility
You can use the Drawing Tools library:
http://code.google.com/apis/maps/documentation/javascript/overlays.html#drawing_tools
which will give you an encoded polyline. You can use that to draw a line, or you can decode it to get the specific points using the geometry library:
http://code.google.com/apis/maps/documentation/javascript/geometry.html

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.