Last modified: 2014-03-28 10:40:42 UTC
It would be great to be able to add custom map types to the googlemaps service. In my specific case, for instance, I would like to overlay the map offered by the Norwegian Mapping Authority (Statens Kartverk) alongside Google's terrain map. Documentation for how to do this can be found here: https://developers.google.com/maps/documentation/javascript/maptypes#CustomMapTypes Using a practical example, with the Norwegian Mapping authority as described, the Javascript code would/could like like this: function StatkartMapType(name, layer) { this.layer = layer this.name = name this.alt = name this.tileSize = new google.maps.Size(256,256); this.maxZoom = 19; this.getTile = function(coord, zoom, ownerDocument) { var div = ownerDocument.createElement('DIV'); div.style.width = this.tileSize.width + 'px'; div.style.height = this.tileSize.height + 'px'; div.style.backgroundImage = "url(http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=" + this.layer + "&zoom=" + zoom + "&x=" + coord.x + "&y=" + coord.y + ")"; return div; }; } var map; function initialize() { var mapOptions = { zoom: 8, center: new google.maps.LatLng(60,9), mapTypeControlOptions: { mapTypeIds: ['topo2', google.maps.MapTypeId.TERRAIN] } }; map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); map.mapTypes.set('topo2',new StatkartMapType("S.Kartverk", "topo2")); map.setMapTypeId('topo2'); }
https://github.com/JeroenDeDauw/Maps/issues/23