Igor's Blog

I've started thinking about how I will go about making a travel diary blog type web application that will be used on an upcoming round-the-world-trip and decided that I will definitely need maps on it. I wanted to do things like display the trip itinerary as a path with markers at each stop, I also wanted to show a zoomed in map of the current travel location. So I needed a way to generate these maps, the most obvious answer was Google Maps, and after a quick search I found exactly what I needed, the Google Maps Static Maps API. This makes static images of the map data, so it won't let you scroll around, etc, but with regard to my project, this is a perfect fit.

There are some quota restrictions and Google recommends that you get an API key, but if you don't use them excessively (less than 25000 requests per day) you should be fine. There are some other restrictions too, notably, the URL to generate the map cannot be larger than 2048 characters. This size restriction means you can't get too fancy with what you create, but it does give a good leeway in terms of customisation.

Anyway with that in mind, here are some examples that eventually work up to the final map that shows the travel path and each of the destination markers.

The first example shows a 300x300 satellite map with the default marker set on my home town.
 Example 1


Working up from this the next example changes the map type to terrain and customises the marker's colour and label.
 Example 2


Now for some paths. I've changed the size of the map to 500x200 so that more of the world is shown and created a path spanning a number of locations. The path colour and weight have been customised too.
 Example 3


That kinda looks ugly with straight lines however. This is easily solved by adding 'geodesic:true' to the path. Instantly the path looks much more familiar and prettier.
 Example 4


Now using the same locations I created markers (no path). The only change I did to the markers has been to change the colour to orange.
 Example 5


That is not exactly the result that I was looking for since I wanted each of the locations to be numbered. Turns out that is not that simple since each marker customisation has to be separate. The only way to do that is to define multiple markers like below. This greatly increases the size of the URL so be careful.
 Example 6


Now putting it all together, the path and the markers are put into the same URL and we get the final result. I've also changed the map dimensions slightly so more of the world is visible.
 Example 7


Looks pretty good and ready to be added to my project.



, ,
About — I'm an enthusiastic software engineer and consultant interested in many fields including J2EE, programming, electronics, 3D printing, video games, wood working and gardening.
See my Resume for more information.
The views expressed in this blog are my own and not those of my employer.
comments powered by Disqus
My other posts you may like...
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
300 George St Blogumentary

My Online Tools

UUID to OID Converter
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

Handling visibility of mobile only pop-over DIVs on a responsive web site

WebLogic package-name element classpath generator script

Using Jersey 2.x as a shared library on WebLogic 12.1.2

Google DFP with AdSense fallback is causing infinite scroll pages to go haywire

Workaround for Mobile Safari scrollTop() not updating during scroll

Skipping execution of Maven plugins that do not have a native skip option

Unmarshalling an XML fragment representing a JAXB object without XmlRootElement

Injecting a ContainerRequestContext into a Jersey entity provider class

Obfuscating PHP source code with Maven and YAK Pro PO

Making use of corner shelves with easy to make slide out draws

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth


RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Follow me on... 
...or subscribe for updates!

Don't show this again