DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:openlayersmap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Both sides next revision
plugin:openlayersmap [2020-07-13 15:03]
mprins a note on Hogfahter
plugin:openlayersmap [2021-05-03 12:04] (current)
mprins
Line 6: Line 6:
 email      : mprins@users.sf.net email      : mprins@users.sf.net
 type       : syntax, action type       : syntax, action
-lastupdate : 2019-03-21 +lastupdate : 2021-04-26 
-compatible : Angua, 2012-10-13, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, 2016-06-26, 2017-02-19, Greebo,!Hogfather+compatible : Angua, 2012-10-13, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, 2016-06-26, 2017-02-19, Greebo,Hogfather
 depends    : geophp depends    : geophp
 conflicts  conflicts 
Line 13: Line 13:
 tags       : media maps embed geo spatial tags       : media maps embed geo spatial
  
-downloadurl: http://netcologne.dl.sourceforge.net/project/dokuwikispatial/openlayersmap/openlayersmap.zip +downloadurl: https://github.com/mprins/dokuwiki-plugin-openlayersmap/archive/master.zip 
-sourcerepo : https://sourceforge.net/p/dokuwikispatial/code+sourcerepo : https://github.com/mprins/dokuwiki-plugin-openlayersmap
-bugtracker : https://sourceforge.net/p/dokuwikispatial/issues/+bugtracker : https://github.com/mprins/dokuwiki-plugin-openlayersmap/issues/ 
 +donationurl: https://github.com/sponsors/mprins
 ---- ----
 ===== Description ===== ===== Description =====
-A map rendering plugin that will put an [[http://openlayers.org|OpenLayers]] based map on the wiki page.  +A map rendering plugin that will put an [[https://openlayers.org/two/|OpenLayers 2]] based map on the wiki page.  
-The component enables users to put GPS data (currently GeoJSON, GPX and KML format are supported) and other geographic services on the map in configurable layout and uses open source components and data ([[http://www.openstreetmap.org/|OSM]]). +The component enables users to put GPS data (currently GeoJSON, GPX and KML format are supported) and other geographic services on the map in configurable layout and uses open source components and data ([[https://www.openstreetmap.org/|OSM]]). 
 It can also be configured to use non-open data (Google, Virtual Earth) providers. It can also be configured to use non-open data (Google, Virtual Earth) 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.   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.  
- 
-=====   Hogfather ===== 
-:!: **you may need to turn off the [[config:defer_js]] feature flag for hogfather if you want this plugin to work, YMMV. Since Hogfather has not seen a stable release I've not been able to try it out. I will work a a new version once a stable release of Hogfahter is there and I have time.** :!: 
- 
  
 ===== Download and Installation ===== ===== Download and Installation =====
 :!: Note: for old releases (2008-05-05, 2009-02-14, Lemming, Anteater, Rincewind) you need [[https://sourceforge.net/projects/dokuwikispatial/files/openlayersmap/|version 1.0]] :!: Note: for old releases (2008-05-05, 2009-02-14, Lemming, Anteater, Rincewind) you need [[https://sourceforge.net/projects/dokuwikispatial/files/openlayersmap/|version 1.0]]
  
-Search and install the plugin using the [[plugin:extension|Extension Manager]] or manually with the download from the [[http://​sourceforge.net/​projects/​dokuwikispatial/files/​openlayersmap/​openlayersmap.zip/download|SourceForge Mirror]]. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-Alternate locations for the plugin and older version are available at: http://sourceforge.net/projects/dokuwikispatial/files/openlayersmap/+Alternate locations for the plugin and older version are available at: https://sourceforge.net/projects/dokuwikispatial/files/openlayersmap/
  
 :!: This plugin needs the server to have [[phpfn>book.image|PHP GD extension]], that in some Linux is not installed by default, but it's the package ''php5-gd'' or alike. Check your ''phpinfo()'' before installing this plugin. If it's not installed you will run into a PHP Fatal error ''Call to undefined function imagecreatetruecolor() ...''. but only if you use the local background rendering engine :!: This plugin needs the server to have [[phpfn>book.image|PHP GD extension]], that in some Linux is not installed by default, but it's the package ''php5-gd'' or alike. Check your ''phpinfo()'' before installing this plugin. If it's not installed you will run into a PHP Fatal error ''Call to undefined function imagecreatetruecolor() ...''. but only if you use the local background rendering engine
 +
  
 ==== Change Log ==== ==== Change Log ====
-=== version 4.14 === 
-  * some small fixes  
- 
-=== version 4.13 === 
-  * Russian language files providd by Aleksej Kozlov 
-  * some small bugfixes 
-  * many more configuration options provided by Aleksej Kozlov 
- 
-=== version 4.12 === 
-  * use EPSG:3857 as basemap projection 
-  * add a geo: uri to the header of popup to open the location in your satnav 
-  * react to page resize 
- 
-=== version 4.11 === 
-  * fix hike and bike static map url 
-  * update google maps api to 3.29 
-  * allow to add Thunderforest API key 
- 
-=== version 4.10 === 
-  * add french translation by Digitalin 
-  * use latest version of OpenLayers 2.14-dev 
- 
-=== version 4.9 === 
-  * some PHP 7 fixes 
- 
-=== version 4.8 === 
-  * drop support for MapQuest; their tile service was discontinued 
-  * add support for Stamen maps (terrain and toner-lite) 
-  * disable hillshading layer; it is no longer available 
- 
-=== version 4.7 === 
-  * PHP 7 compatibility fixes 
- 
-=== version 4.6 === 
-  * use latest version of OpenLayers 2.14-dev 
-  * update google maps api to 3.22 release 
- 
-=== version 4.5 === 
-  * use latest version of OpenLayers 2.14-dev 
- 
-=== version 4.4 === 
-  * use latest version of OpenLayers 2.14-dev 
- 
-=== version 4.3 === 
-  * some small bugfixes 
-  * update google maps api to 3.17 release 
- 
-=== version 4.2 === 
-  * add background to map 
-  * display Point of Interest coordinates in popups 
-  * allow coordinate display in decimal degrees or degrees, minutes, seconds 
- 
-=== version 4.1 === 
-  * add a fullscreen option for the map 
-  * fix an IE8 bug 
-  * fix static map generation, different maptypes were not respected 
-  * add configuration option for a MapQuest API key (needed for remote static map generation) and Google API key 
-  * semi-responsive map rendering (on page load only); prevent maps that are larger than the page width 
- 
-=== version 4.0 === 
-  * use OpenLayers 2.14-dev 
-  * keyboard accessible zoom control replacing the pan/zoom bar 
-  * keyboard accessible layer switcher control 
-  * keyboard accessible feature info control 
-  * removed the toolbar 
-  * remove the Cloudmade layers; Cloudmade went "enterprise only" 
-  * removed the option to set openlayers library, this is no longer possible 
-  * remove styling admin option and remove associated images, use the wiki styling from now on 
-  * add help pages (en, nl) 
- 
-== deleted files == 
-  * controlbar images: 
-    * lib/classic/* 
-    * lib/dark/* 
-    * lib/orange/* 
-    * lib/grey/* 
-    * lib/neutral/* 
-    * lib/theme/* 
-  * img/navigation_history.png 
-  * img/icon_*.png 
-  * logo/cloudmade_logo.png 
- 
-=== version 3.1 === 
-  * use OpenLayers 2.13 
-  * improvements and bugfixes in the static map generator 
-  * upgrade the google api 
-  * add orange style 
-  * drop cUrl requirement by enabling fall-back to file_get_contents 
-  * add support for GeoJSON 
-  * remove permalink from the map 
-  * some accessibility enhancements 
  
-== deleted files == +The [[https://github.com/mprins/dokuwiki-plugin-openlayersmap/commits/master|complete changelog is available]] on GitHub
-  * overview-switcher-minimize.png +
-  * overview-switcher-maximize.png+
  
-=== version 3.0 === 
-  * A local static map generator was added. Note that this requires php-curl and the geophp plugin. 
-  * A management interface for the static map generator was added 
  
-===Version 2.1  === +{{rss>https://github.com/mprins/dokuwiki-plugin-openlayersmap/commits/master.atom date}}
-  * provide an extension point for [[openlayersmapoverlays]]  +
-  * updated the [[http://openlayers.org|OpenLayers]] build to 2.12 Final+
  
-===Version 2.0=== 
- brings the following changes: 
-  * support for “Angua” and jQuery 
-  * fix a negative coordinates bug ([[http://sourceforge.net/tracker/?func=detail&aid=3399949&group_id=239475&atid=1110186|3399949]])  
-  * Spanish translation 
-  * small fixes and enhancements 
-  * updated the [[http://openlayers.org|OpenLayers]] build to 2.12 
-  * more icons 
-  * add some more open base layers (transport, landscape,.. ) 
-  * accessibility improvements 
-  * remove the depercated t@h base layer 
-  * using v3.8 of the Google api for Goole maps 
-  * various small enhancements and fixes 
-  * use [[http://openlayers.org|OpenLayers 2.12]] 
  
-===Version 1.0=== 
- brings the following changes: 
-  * Yahoo was removed; they are shutting down their maps api ([[http://sourceforge.net/tracker/?func=detail&aid=3322552&group_id=239475&atid=1110189|3322552]]) 
-  * switched to Google Maps v3 ([[http://sourceforge.net/tracker/?func=detail&aid=3035248&group_id=239475&atid=1110189|3035248]]) 
-  * Add support for ReST access of the Bing layers (bing road, bing sat, bing hybrid) and deprecated Virtual Earth (ve) [[https://sourceforge.net/tracker/?func=detail&aid=3356282&group_id=239475&atid=1110189|3356282]] 
-  * option to disable OSM base layers 
-  * option to disable MapQuest Open layers 
-  * Accessibility and printing enhancements: 
-    * enhancements to show a static fallback map for users that do not have javascript or css which is also used as the print page((this option may be disabled)) 
-    * a table with the points of interest((this option may be disabled)) 
-    * a description can be entered for the map 
-    * better styling 
-  * theme's for some of the controls [[https://sourceforge.net/tracker/?func=detail&aid=3354326&group_id=239475&atid=1110189|3354326]] 
-  * :!: dimensions for map width and heigth must be in pixels [px]; previously other units such as % and em may have worked. This is to make sure that the static fallback map works properly. 
-  * use [[http://openlayers.org|OpenLayers 2.11]] 
  
 ===== Configuration ===== ===== Configuration =====
Line 176: Line 47:
  
   * **enableOSM** Enable the use of OpenStreetMap base layers as basemap provider   * **enableOSM** Enable the use of OpenStreetMap base layers as basemap provider
-  * **enableMapQuest** Enable the use of MapQuest Open as basemap provider +  * **enableMapQuest** Enable the use of MapQuest Open as basemap provider (removed in current versions) 
-  * **enableGoogle** Enable the use of Google as basemap provider+  * **enableGoogle** Enable the use of Google as basemap provider (removed in current versions)
   * **enableBing** Enable the use of Bing as basemap provider   * **enableBing** Enable the use of Bing as basemap provider
   * **bingAPIKey** Bing requires an API key, get yours at: https://www.bingmapsportal.com/application   * **bingAPIKey** Bing requires an API key, get yours at: https://www.bingmapsportal.com/application
 +  * **tfAPIKey** Thunderforest (cyclemap,transport, landscape and outdoors) requires an API key, get yours at: https://www.bingmapsportal.com/application
   * **mapquestAPIKey** MapQuest Static Maps API key, get yours at: http://developer.mapquest.com/   * **mapquestAPIKey** MapQuest Static Maps API key, get yours at: http://developer.mapquest.com/
-  * **googleAPIkey** Google Static Maps API key, get yours at: https://code.google.com/apis/console+  * **googleAPIkey** Google Static Maps API key, get yours at: https://code.google.com/apis/console  (removed in current versions)
   * **iconUrlOverload** URL for map icons when using static maps on a non-public access host such as with [[install:dokuwiki_on_a_stick|DokuWiki on a Stick]] or [[https://sourceforge.net/projects/dokuwikispatial/files/DokuWiki%20portable/|DokuWikiStickNG]]   * **iconUrlOverload** URL for map icons when using static maps on a non-public access host such as with [[install:dokuwiki_on_a_stick|DokuWiki on a Stick]] or [[https://sourceforge.net/projects/dokuwikispatial/files/DokuWiki%20portable/|DokuWikiStickNG]]
   * **enableA11y** Enable a11y/print output (static map, legend table). If you use maps with a lot of POI you will want to turn this off   * **enableA11y** Enable a11y/print output (static map, legend table). If you use maps with a lot of POI you will want to turn this off
Line 427: Line 299:
  
  
 +-----
 +After installing the plugin (in Hogfather, DokuwikiStick), when I open a map, I get multiple PHP warnings about address parsing of the OL-tiles and one warningon header information:
 +
 +Warning: file_get_contents(http://tile.openstreetmap.org/12/2108/1391.png): failed to open stream: Failed to parse address ":" in D:\DokuWikiStick\dokuwiki\lib\plugins\openlayersmap\StaticMap.php on line 426
 +
 +Warning: Cannot modify header information - headers already sent by (output started at D:\DokuWikiStick\dokuwiki\lib\plugins\openlayersmap\StaticMap.php:426) in D:\DokuWikiStick\dokuwiki\inc\actions.php on line 38
 +
 +Those were clean installs, so I have no idea what could have gone wrong.
 + --- [[user>Wernazuma|wernazuma]] //2020-12-23 15:30//
 +
 +-----
 +Like [[user>wkaurzinek|Werner]] I found I //had// to install the [[https://www.dokuwiki.org/plugin:geophp?s[]=geophp|geophp]] plugin, unfortunately the link from the plugin page no longer resolves. To work around this I downloaded the source [[https://geophp.net/|geophp]] from the project page and extracted it to ''lib/plugins/geophp/geoPHP/'' setting ownership appropriately.
 +
 +This allowed some of my maps to render but some didn't throwing an error about a division by zero.
 +
 +<code>
 +2021/04/10 10:05:57 [error] 44968#44968: *78690 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "base" in /srv/http/sheffieldboulder/inc/
 +xtension/PluginController.php on line 107PHP message: PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in /srv/http/sheffieldboulder/lib/plugins/
 +penlayersmap/StaticMap.php:671                                                                                                                                   
 +Stack trace:                                                                                                                                                     
 +#0 /srv/http/sheffieldboulder/lib/plugins/openlayersmap/StaticMap.php(694): StaticMap->autoZoom()                                                                
 +#1 /srv/http/sheffieldboulder/lib/plugins/openlayersmap/helper/staticmap.php(103): StaticMap->getMap()                                                           
 +#2 /srv/http/sheffieldboulder/lib/plugins/openlayersmap/syntax/olmap.php(684): helper_plugin_openlayersmap_staticmap->getMap()                                   
 +#3 /srv/http/sheffieldboulder/lib/plugins/openlayersmap/syntax/olmap.php(144): syntax_plugin_openlayersmap_olmap->_getStaticOSM()                                
 +#4 /srv/http/sheffieldboulder/inc/parser/handler.php(279): syntax_plugin_openlayersmap_olmap->handle()                                                           
 +#5 /srv/http/sheffieldboulder/inc/Parsing/Lexer/Lexer.php(270): Doku_Handler->plugin()                                                                           
 +#6 /srv/http/sheffieldboulder/inc/Parsing/Lexer/Lexer.php(197): dokuwiki\Parsing\Lexer\Lexer->invokeHandler()                                                    
 +#7 /srv/http/sheffieldboulder/inc/Parsing/Lexer/Lexer.php(147): dokuwiki\Parsing\Lexer\Le" while reading response header from upstream, client: 13.66.139.29, server: sheffieldboulder.uk, request: "GET /doku.php?id=osgathorpe:osgathorpe HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "sheffieldbouldr.uk"                                                                                                                                                            
 +</code>
 +
 +This only occurred on maps with a single ''geom'' marker and as the above error message shows its a ''division by zero'' on line ''671'' of ''openlayersmap/StaticMap.php'' Looking at the code there is on lines ''657-660'' a clause that exits the ''autoZoom()'' function early if there is one or less geoms.  I don't think this is being entered as the rest of the function is being executed on these maps.  This means that the ''miny'' and ''maxy'' are the same, resulting in ''$vy0'' and ''$vy1'' being the same value and when these are subtracted the differnce is ''0'' and in turn so is denominator in the calculation on line 671 (which tallys with the reported error).
 +
 +If I drop a second independant point/geom on the map this problem doesn't occur.
 +
 +A bit of digging showed that this is because with a single geom listed in the OpenLayersMap entry such as...
 +
 +<code>
 +<olmap id="olMapOne" width="900px" height="500px" lat="53.357647" lon="-1.454227
 +9" zoom="18" statusbar="1" toolbar="1" controls="1" poihoverstyle="0" baselyr="O
 +penStreetMap" gpxfile="" kmlfile="">
 +~~ More examples: http://dokuwiki.org/plugin:openlayersmap
 +53.357647,-1.4542279,0,0.8,peak.png,Lichfield Road Boulder, Newfield Green \\ in
 +ternal link:[[::lichfield:lichfield|Lichfield Road Boulder, Newfield Green]]
 +</olmap>
 +</code>
 +
 +...the value of '' count ( $geoms )'' is ''2'' rather than ''1'' A simple workaround is to change the clause so that ''autoZoom()'' exits early...
 +
 +<code php>
 +               if (count ( $geoms ) <= 2) {       
 +                        dbglog($geoms,"StaticMap::autoZoom: Skip setting autozoom options");
 +                        return;
 +                }
 +</code>
 +
 +I've reported the issue on SourceForge (see [[https://sourceforge.net/p/dokuwikispatial/issues/73/|here]]) and on review see its the same error as reported in 2017 in this Discussion.
 +
 + --- [[user>slackline|slackline]] //2021-04-10 10:08//
plugin/openlayersmap.1594645383.txt.gz · Last modified: 2020-07-13 15:03 by mprins