Saturday, 7 March 2009

Where I've Been



This post has been superseded by new instructions using the Google's updated API. I don't know for how long this version will continue to work.

This is partially for anyone who actually wants to know where I've travelled, but mostly because I found a really cool way of making a little map through Google API and I thought you might like to know about it.

I've used the "Where I've Been" app on Facebook for a while, and I wanted a more flexible version that I could use for my website.

A bit of a search and I found Google's funky chart API which gives a way of plotting all sorts of charts - including MAPS.

My map:



Pink is for places I've been; blue is where I'm hoping to go soon (not the only places I'm hoping to go soon, mind you).

The code (non-geeks may wish to look away now...)

<img src="http://chart.apis.google.com/chart?cht=t&chs=440x220&chtm=world&chf=bg,s,ffffcc&chco=cccccc,cc0066,0066cc&chd=t:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,100,100,100,100,100,100,100,100,100,100,100&chld=ATCACHCNCUDEDKEEESFIFRGBGGGIIEISITMNRUSEUSGLJPIMINAUBRETFOGRNONZ" width="440" height="220"/>

The cool bit is the 'chld' field which takes two-letter country codes (to determine where to colour). And then for each country I have a number in the 'chd=t:' section stating whether it should be pink (0) or blue (100). You can of course make it more complicated with extra colours.

All credit to Google for making this possible (and relatively easy). I'm hooked :)

4 comments:

Chef E said...

Yikes, I need my engineer hubby who writes code to help me read this post! Wow you have been almost everywhere I want to go, and the places on my to go list...

Jeanne said...

I can't even get Google-freaking-Analytics to work (except for about 10 minutes one time, then it stopped, never to work again). Which particularly fries my chips because I used to be a programmer!

(Cool widget, though.)

Domestic Executive said...

This is a great gadget. Makes you realise how far you've travelled the global and how much more exploration you can still do.

Elizabeth Braun said...

As you'll be about to updatge your map to turn Greenland pink, I wondered if you might consider re-posting this map gadget thingy, but with some extra details for those of us who just can't follow the code! Well, I get much of it, but I think the following would help:

*I think I can see 4 colour codes, which correspones to which colour on the map?
*How are the 0s and 100s ordered in relation to the country codes? I'm assuming they're in the same order?
*A link to a site with the complete list of country codes would also be good.

I can probably work much of this out myself, but then I understand basic (and now rather old-fashioned) HTML, whereas many won't be able to. I'm sure a lot of people would love to use this, but many of them might need a bit more 'training' first!=)

Loving the Greenland posts!

Post a Comment

Thanks for dropping in! I'd love to hear what you have to say, and if you leave a URL, I'll be round to visit you soon. (Comment moderation is on because the spam has become overwhelming!)

Related Posts Plugin for WordPress, Blogger...