Saturday, January 05, 2008

Google Mapplets and Custom Writeable Pushpins

Well, I came up with some simple and yet incredible code for Google Maps or Google Mapplets. I think this is just brilliant but you may think otherwise.

Ever wanted to put something on those push pins other than a number or a custom graphic. Well low and behold I did this recently and it's pretty simple. If youre familiar with PHP you'll say to yourself why didnt I think of that.
So let's review what we have here. Lines 2-5 are basic sanity checking for a "rate" which is nothing more than a number.


Line 6 is changing the response type for this PHP script to an image.

Line 7 loads up a base image to write text to.

Line 11 put's the text onto the pushpin.

Line 12 Returns the image

That's it folks. Now you have some very cool push pins for google maps. What do you put on them? Well that is up to you. I used "rate" data from banks. You could in theroy put names of things, locations, anything. One template image is used then from there you write the text you want onto the graphic.

This DOES support transparency by the way. I needed that myself. One thing though is that IE6 doesnt support PNG transparency the right way so if you do this you might want to use a GIF instead of a PNG.

If you find this useful please post something on this blog. I'd just like to see how this is being used.

No comments: