Friday, December 7, 2012

My Places Overlays on Maptiler Google Map

Maptiler is a good option for creating image overlays (such as historical maps) on Google Maps.  There are some snags though -- the code is still using gmaps API v2, which will give some indication for the attention being given to the project right now.  

 The problem I ran into was adding overlays (such as a KML or GeoRSS feed) on TOP of the image overlay, and correct behavior with the opacity slider built into the maptiler output.

Here are the simple edits to fix this issue.

  1. Added a My Places KML overlay by copying the KML URL from My Places and these two lines (I put those at 185, just below the construction of the new map object)
  2.  geoXml = new GGeoXml("https://maps.google.com/maps/ms?authuser=0&vps=1&ie=UTF8&msa=0&output=kml&msid=204904299571298064529.0004d01c986fdc0fe9f19");  
     map.addOverlay(geoXml);  
    
  3. Changed zPriority of maptiler overlay so that it sits below other overlays (I edited the line at ~224 which constructs the "overlay" object
      overlay = new GTileLayerOverlay( tilelayer,{zPriority:-1000});  
    
  4. Finally, I fix the opacity slider by changing the line that removes all overlays to just remove the maptiler overlay, and reinitilize it at zPriority -1000 around line 62
     this.map.removeOverlay(this.overlay);  
     this.map.addOverlay(this.overlay, { zPriority: -1000 });  
    
  5.  
    That's it!

No comments: