I have a bunch of hardiness zones, as you can see here: http://mangoly.herokuapp.com/workroom/googlemaps/zones/

They are solid colored PNG images. I know the geo coordinates of the bottom left hand corner of all the images (they are all in the same corner). I am able to add these to the Google Maps API as groundoverlays with no problem. However I would like to make these layers clickable. So my guess is I need to convert the images into some kind of vector/geo data format. Because since each image has white space, they are all stacked on top of each other. So when I click on a layer, it will think I am choosing top most image. I need to some how convert the image into a format that make google maps understand that I only care about the actual solid color and not the white space (polygons maybe?).

Any ideas?


I am pretty sure you want to convert these files to KML or KMZ files(they are pretty much the same thing) This will allow you do make them click-able objects with associated information. I was able to load one of the png files into ArcGIS and create a kmz file that ignored the empty space. This would allow you to have them all layered on top of each other without having to worry which one was the top layer. The one thin you would have to do is determine a second point on each physical feature in the png files. with the point you already know and a second one you can georeference them (Make sure you are using wgs84 for your projection for optimal google earth compatibility)There are a number of other ways to get these files converted to KMZ files, this is just the one I could try during my lunch break at work. I hope this helps put you on the right track.

Final Thought: If you do not have access to ArcGIS (it is very expensive and many people do not have access) qgis is a free open source program that should be able to do the same thing for you.


gdal_polygonize.py will do convert your .png images to KML (or other vector formats). You will first need to geo-reference your .png images. You said you already have the location of the lower-left corner. You will also need the projection and the pixel scale (I'm guessing you won't need rotation or skew parameters if you're able to make them work as overlays in Google Maps.)

Once you have the required data, you can create a gdal virtual raster (VRT) which will associate the geo-referencing data and the .png into a single object that gdal_polygonize can accept as input.

One big caution about this process - the KML that comes out of gdal_polygonize does not simplify or smooth the polygons it produces. It includes every jaggie step in the input image, and thus produces very verbose KML. There are ways to smooth polygons, but that's a topic in itself.


There are a number of similar questions to this already on our site, that you may be able to derive some solutions from:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.