Last modified: 2014-03-28 10:40:42 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T46869, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44869 - Ability to add custom maptypes with the googlemaps service
Ability to add custom maptypes with the googlemaps service
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Maps (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-11 11:34 UTC by kvolden
Modified: 2014-03-28 10:40 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description kvolden 2013-02-11 11:34:08 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');
}
Comment 1 Jeroen De Dauw 2014-03-28 10:40:42 UTC
https://github.com/JeroenDeDauw/Maps/issues/23

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links