About Me

My photo
Hello, I'm a technology geek looking to upgrade my programming skills. These are some of the things I'm learning along my journey.

Tuesday, December 11, 2012

Create a Custom Static Map

Have you ever wanted to include a customized Google map in you web page without much coding? Google's Static Map service service creates your map based on URL parameters sent through a standard HTTP request and returns the map as an image you can display on your web page.



The easiest way to include a map is to simply go to Google Maps and insert an address or coordinate in the search box. Once you have selected the location and style of map, click on "Customize and preview embedded map". Here you are offered some limited options to adjust your map. After you have selected your options, copy and paste the code into your web page. Some of the options can be adjusted after pasting.

A more customized map can be achieved with the Google Static Map Wizard. Follow the instructions and copy the code. Paste it into an "img" tag on your web page. Once pasted, change the "sensor=TRUE_OR_FALSE" to "sensor=false" so that the map will show up in you browser.

Example:

The URL in the pasted code can be further enhanced by adding parameters listed in the "Static Maps API V2 Developer Guide". Try out the "Quick Example" in your own code and make minor adjustments to see what happens.




No comments:

Post a Comment