Sunday, February 15, 2009
Google Maps can only handle KMLs with points, lines, and polys. Ground overlays are strictly verboten. However, you can overlay images in Google Maps using mapplets. The process is simple and well documented. The basic steps are: 1. write your mapplet, the example below contains all the tags that the example on google doesn't show for your cut-n-paste enjoyment: <?xml version="1.0" encoding="UTF-8"?> <module> <moduleprefs title="1929 Map of San Antonio, Texas" height="300"> <require feature="sharedmap"> </require></moduleprefs> <content type="html"><![CDATA[ <small> This is a georeferenced map of San Antonio, Texas in 1929. The original map is at http://www.tsl.state.tx.us/arc/maps/images/map1052a.jpg </small> <script> var map = new GMap2(); map.setCenter(new GLatLng(29.4208378,-98.4938900), 12); // ground overlay var boundaries = new GLatLngBounds(new GLatLng(29.3400022,-98.5543116), new GLatLng(29.5016733,-98.4334683)) var oldmap = new GGroundOverlay("http://www.tsl.state.tx.us/arc/maps/images/map1052a.jpg", boundaries) map.addOverlay(oldmap) </script> ]]></content> </module> 2. Upload your code to a server or to Google page creator. 3. Install it on Google Maps directory. 4. Share the map using a long url like this: http://maps.google.com/ig/add?synd=mpl&pid=mpl&moduleurl=http://www.geouptime.com/mapplet_san_antonio_1929.xml Google will ask you if you want to add it to maps (I assume it means your maps). Clicking on Add it to Maps opens the mapplet. Voila!
I write on another blog documenting the history of my house in San Antonio, Texas. As part of the research we found that there was streetcar service close the house. A quick search turned up a map of the streetcar lines at the Texas Transportation Museum. I thought it would be neat to overlay that map over other map services. I first tried to georectify the Texas Transportation Museum map using Metacarta Labs Map Rectifier, but the quality of the scan was too poor to successfully add enough ground control points for a good warp. Another search turned up a much better scan of a 1929 map at the University of Texas Perry-Castaneda Library Historic Map collection. This map was scanned at a very high resolution and it was easy to create a sufficient number of ground control points to use a cubic fit georegistration using Metacarta's Map Rectifier. The result was a 215mb tif file which I was able to download. Thanks Metacarta! The next step was to trace the streetcar lines using uDig. I used version 1.1.1 which is verrrry slooowww when it comes to handling largish tif files. I heard that raster handling is improved in 1.2 beta as well as more digitizing tools, so you might want to use that. Once I figured out the editing tools it was fairly easy to digitize the streetcar lines. Always the critic, I have to say the the editing tools could use some context sensitive menus available through a right click. I saved the streetcar lines as a shape file and I saw that uDig has a number of tools for cleaning up the data and validating the output. Nice. I converted the shape file kml using ogr2ogr. The first time I tried it ate my shape file, no idea why. I noticed that my gdal install was way out of date (version 1.4), so I installed version 1.6 for OS X from the Kyng Chaos Wiki. Using ogr2ogr was straight forward:
View Larger Map
ogr2ogr -f KML sa_streetcars.km streetcar_lines.shpI tweaked the KML in a text editor so that each streetcar line was a consistent color. Then I uploaded it to myGoogle maps. The 1929 map overlays fairly well but not exactly. I think it was important to use a historic map for digitizing the lines instead of using a modern map such as Open Street Map, Google Maps, or the Census Bureau's TIGER street files because there have been many changes to the street network since the streetcars were in service. The lines may not overlay perfectly, but I think its a better representation. Here's the data and final map:
View Larger Map
Posted by sophia at 7:12 AM