Sunday, 16 October 2011

Embeding Google Map Image API for blog and websites

To embed google map image of a place, city or a country you need to:



<img src="http://maps.googleapis.com/maps/api/staticmap?center=-15.800513,-47.91378&zoom=11&size=200x200&sensor=false">


  • now you have to just replace the bold text i have underlined in the above url with the latitude or longitude of the place you want to show on the map for example your home, office etc. if you don't know the coordinates just find the coordinates on google map OR pass the replace the text with place's name.
  • for example to show New Delhi on the map you should write




<img src="http://maps.googleapis.com/maps/api/staticmap?center=new delhi&zoom=11&size=200x200&sensor=false">
this will show:

  • if you wan,t to pass dynamic variable, just use following code:
<img src="http://maps.googleapis.com/maps/api/staticmap?center=<?php echo $placename; ?>&zoom=11&size=200x200&sensor=false">



No comments:

Post a Comment