Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




Recent Comments

Powered by Disqus




Back to articles

Print google maps or include in PDF

Everyone knows and everybody loves Google Maps. They provide easy interface to enhance your web aplication using maps with different customizations. Al those maps are dynamically generated using Javascript, so what happens when you want to print map or for example include in PDF file? It probably won't appear there, because you can include only HTML/CSS but not Javascript generated content. So what should you do? Here a simple answer

Use Google Maps static image API. It's the way to provide parameters via $_GET data and receive simple image, which then can be easily printed or included in PDF.

Here is a quick example:

Link example: http://maps.google.com/maps/api/staticmap?center=56.9550198,24.1191180&zoom=13&size=280x200&maptype=roadmap&sensor=false&markers=color:red%7Ccolor:red%7Clabel:C%7C56.9550198,24.1191180

Just use http://maps.google.com/maps/api/staticmap and provide some parameters like:

Param name Explanation Example value
center Center of map as longitude,lattitude 56.9550198,24.1191180
zoom Zoom of map 13
size Size of map in pixels (width x height) 280x200
maptype Type of map roadmap
sensor Usage of tracking sensor (GPS) false
markers Define markers color:red|label:C|56.9550198,24.1191180 

You may also be interested in:

Powered by BlogAlike.com

blog comments powered by Disqus