openlayersmap plugin

openlayersmap plugin by Mark C. Prins
Add maps (OpenStreetMap, Google, Virtual Earth, Yahoo and your own data) to your wiki pages using the OpenLayers toolkit

Last updated on 2010-07-27. Provides Syntax.
Compatible with DokuWiki 2008-05-05, 2009-02-14, 2009-12-25 "Lemming".

Similar to googlemaps, osm.

Tagged with embed, maps, media.

Description

A map rendering plugin that will put an OpenLayers based map on the wiki page. The component enables users to put GPS data (currently GPX and KML format are supported) and other geographic services on the map in configurable layout and uses open source components and data (OSM). It can also be configured to use non-open data (Google, Virtual Earth, Yahoo Maps) providers. The plugin dynamically loads the OpenLayers API on demand, depending on the API license keys that are entered in the configuration section various base map layers are available.

Download and Installation

Download and install the plugin using the Plugin Manager using the given URL. Refer to Plugins on how to install plugins manually. Alternate locations for the plugin and older version are given below.

Source code can be found on the Sourceforge.net Subversion site. use the following command to check out everything:

svn co https://openlayersmap.svn.sourceforge.net/svnroot/openlayersmap/trunk openlayersmap

News & Updates

Configuration

Currently the following options can/need to be configured (see conf/default.php):

Demonstration

Syntax/ Usage

<olmap id="olMap" width="600px" height="400px" lat="52.0" lon="5.1" zoom="12" statusbar="1" toolbar="1" controls="1" poihoverstyle="1" baselyr="OpenStreetMap" gpxfile=":playground:hardlopen_gpx.gpx" kmlfile=":playground:mtb.kml">
52.1,5.1,,60,.8,marker-green.png,Just a spot
</olmap>
  • id - div id of the map (this needs to be a valid CSS identifier as well as a valid JavaScript variable)
  • width ? 999px (e.g. 500px) width of the Google map, default is 400px.
  • height ? 999px (e.g. 500px) height of the Google map, default is 300px.
  • zoom ? integer, zoom level, default value 5. Valid values depend on the map and location.
  • controls ? values on | off. default on. Whether or not to show controls for zooming and panning on the map.
  • toolbar ? values 1 | 0. default 1 (on). defines if the toolbar is built
  • statusbar ? values 1 | 0. default 1 (on). defines if the statusbar is built
  • poihoverstyle - values 1 | 0. default 1 (on). specifies POI feature select behaviour (hover or click)
  • lat ? values -90.0 - 90.0; latitude of map centre, negative values are south. (WGS84)
  • lon ? values -180.0 - 180.0; longitude of map centre, negative values are west. (WGS84)
  • baselyr ? values OpenStreetMap | t@h | cloudmade map | cycle map | google relief | google sat | google hybrid | google normal | yahoo | ve (note that for the non-open maps you need the key/URL as well)
  • gpxfile ? any GPX file, use the media manager to retrieve the location
  • kmlfile ? any KML file, use the media manager to retrieve the location

The Points of Interest are formatted:

lat, lon, rotationangle, opacity, image, textforpopup

The map will zoom in to the extent of the POI. The text for the popup can be formatted using regular DokuWiki syntax and may contain links as well. (see discussion below for enhanced sample)

Known Limitations

This is currently a work in progress; please check the Tracker on the SourceForge.net site. I will make a stable release when OpenLayers 2.9 is released.

  • the controls/toolbar/statusbar options do not always work as expected
  • there are some issues when the wiki site runs on HTTPS because all of the mapservices used (OSM, Google,Yahoo, etc) run on plain HTTP, this will present your viewers with warning messages. (cross domain warning)

Discussion

I like the looks of this plugin. I am currently using google_maps and while it works fairly well, it is a bit lacking. With this plugin, can the dimensions of the locational marker pop-ups be fixed/changed? Is wiki text parsed within said pop-ups? I like to write short descriptions with each marker, so I need to format the text and text box to avoid stretching across the screen.

Thanks for the plugin.
Mark you're welcome :-). there are currently no provisions to parse wiki text or URLs (link tags works e.g.
[[http://test.com|test]]

you probably want to set poihoverstyle=“0”). see sample below, it does links, line breaks an formatting.

<olmap id="olmap" width="600px" height="400px" lat="50.0" lon="5.1" zoom="8" statusbar="1" toolbar="1" controls="1" poihoverstyle="0">
49.9780098,5.1839387,270,.7,marker-gold.png,Faux Mayaux; Maissin \\ ** Watch out crossing the street **
50.0117497,5.1287857,60,.8,marker-green.png,Pont de Barbouillons; Daverdisse \\ external link: [[http://test.com|test.com]] \\ internal link: [[::start]]
</olmap>


The size of the markers is fixed, so even if you use larger bitmaps they will be scaled down, this in part has to do with the hover area and is just how things work in OL.

Hi Mark, I like your plugin too, it's well written. I've left a request on your tracker, suggesting the possibility of pulling the coordinates from a database instead of hard-coding them on the page. If using the PEAR library like one of the MySQL plugins, it shouldn't be too complex ? This would make for a powerful way of displaying multiple real-time coordinates.
<olmap id="olmap" width="480px" height="480px" lat="51.8795" lon="8.506751" zoom="12" statusbar="1" toolbar="1" controls="1" poihoverstyle="0" baselyr="Google hybrid">
51.8795,8.506751,30,.5,marker-gold.png,Start;Start
</olmap>


With this Code I see no marker and “Goggle Hybrid” is not displayed. Why? See in Action at http://www.jan-hendrikbade.de/doku.php/wiki:plugins#openlayers_map

I suspect this is the same issue as described in 2896534. The case of the layername is converted to lowercase (the “G” ends up as a “g”) causing this behaviour. 1) As for the marker; I have no idea, I ran your page through Firebug and that gives me a “too much recursion” error (I've never seen that yet), maybe you can give it a try with most extensions disabled? Also I don't see the toolbar!? –Mark
I installed the Version from 31.1(VERSION File) but nothing changes… See: http://www.jan-hendrikbade.de/doku.php/playground:playground Now I deactivated all the plugins and… IT WORKS Thank You! I found the mad add-on: http://www.inetsoftware.de/other-products/dokuwiki-plugins/miniajax it is used by ImageFlow
I guess miniajax redefines the builtin “$”
But now the zoom is always set to 18, see http://www.jan-hendrikbade.de/doku.php/playground:playground
Yes, the map automatically zooms to the extent of all the POI within the allowed range of zoomlevels, so when you have one POI, or a couple that are really close the map zooms in to the highest resolution, effectively ignoring the scale.

»»A workaround for this is to have some POI that you give a transparency of 1 and that are a few hundred meters apart… see: 2949057 This has now been fixed properly

1) this has been fixed
 
plugin/openlayersmap.txt · Last modified: 2010/07/27 14:30 by 145.12.10.1
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate