User:Danwe/maps with image layer

From MediaWiki.org
Jump to navigation Jump to search

Recently, I have been developing to re-introduce the custom image layer feature to the Maps extension.

This will allow you to define custom ground layers based on images which will serve as your map. This feature only works with OpenLayers currently.

Installation:[edit]

  • Download the Maps branch on GIT. This is my working branch with the new feature.
  • Replace your current Maps installation directory with the downloaded one or follow the Maps installation instructions.
  • Run MediaWiki's Update.php which is necessary for updating the database.
  • Insert something like this in one page of the namespace "Layer", e.g. "Layer:MyCustomLayer":
<layer type="image" name="normal">
type = image
source = myMap.jpg
width = 2000
height = 1443
left bound = -222.240
lower bound = -160.34616
right bound = 222.240
upper bound = 160.34616
zoomlevels = 5
units = km
maxScale = 1200000
minScale = 350000
</layer>
In this case, myMap.jpg had to be a media File in your Wiki, e.g File:myMap.jpg.
  • On the page, where the map should be displayed, this code has to be inserted:
<display_map service="openlayers" layers="MyCustomLayer" height="800">0,0</display_map>

Normal maps features working with OpenLayers should all be available on this custom map now. E.g. you can insert markers just like you would do it with any other predefined map displayed in OpenLayers.