I want to pass several parameters to this url and generate the map from it and show it in my java application. I know the code to download the image and show it in the java application. I want to know how to pass parameters to this address:
In this link Nugegoda and Mirihana and Udahamulla is the one that i should pass from the application. And then it will generate a image and i do need to show it. Even if u check this link. It's a image.
Can someone help me?
The Static Maps API can do geocoding for you if you pass a valid address to the center
parameter:
https://maps.google.com/maps/api/staticmap?center=Nugegoda&zoom=14&size=400x400&sensor=false
The parameters that you can pass are all listed here. As is standard in URLs, all parameters are separated using the ampersand &
character. Therefore if you want to add the maptype
parameter and set it to hybrid
for example, you can simply add &maptype=hybrid
to the above URL:
Then if you want to show the Udahamulla map, simply replace Nugegoda with Udahamulla for the center
parameter:
https://maps.google.com/maps/api/staticmap?center=Udahamulla&zoom=14&size=400x400&sensor=false
UPDATE:
Further to the comments below, you can add a polyline on a static map by using the path
parameter, as follows:
Note how the API geocodes the addresses "Maharagama" and "Nugegoda", so you do not need to pass the latitude and longitude coordinates of the localities.
Currently the Static Maps API does not do driving directions. However if you have the points of a complex route, you could plot the path as an encoded polyline.