Plugin Map | |
Use this wiki plugin to display a map on a wiki page with a wide range of customisation options. See also Geolocation for how other Tiki objects, e.g. wiki pages, blog posts etc. can be geolocated. |
Historical overview of Maps integration in Tiki | |
Maps have been supported in Tiki since 2003 (which is why some call it a GeoCMS). There is geo-related info in various places (users, trackers, image galleries, articles, blog posts, etc.). This was originally done using MapServer, an active and powerful FLOSS mapping solution. However, it requires a dedicated server and more importantly, access to map data (which is not easy).
Then, after a community discussion, starting in Tiki7, OpenLayers (another option was Mapstraction) was added as a native way to handle maps, which permits the use of tiles from Google Maps, Bing Maps, OpenStreetMap (which is like Wikipedia but for maps), MapQuest (which serves OpenStreetMap maps), etc. The Cartograf project further improved maps in Tiki8, Tiki9, Tiki10 and Tiki11. Many features were added, including Street View support. In Tiki12, all Google Maps specific code was removed in favor of using OpenLayers, so Google Maps is accessible via the OpenLayers Google Layer. In addition the Natural Access project (no longer active) added further new capabilities to upload any existing line and polygon data as files and to be able to further customise how data objects were shown on the underlying map layer. In Tiki15 all MapServer-specific code has been removed. Also OpenLayers 2.x continues to be used for the map layer and integration with Tiki to allow editable map objects to be overlaid on the map layer but experimentation has started with the integration of OpenLayers 3.x. In Tiki20 integration with OpenLayers 3.x and higher was improved, and more features were exposed through the corresponding PluginMap parameters, as well as adding new tilesets, some of them using vector tiles instead of just the usual raster tiles. Map-related documentation, as of summer of 2019, still makes reference to the different historical approaches but as it continues to be improved the older methods that are no longer used will be deprecated/removed. Volunteers to help with documentation improvement : please contact marclaporte at tiki dot org |
Parameters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Display a map Introduced in Tiki 1. Go to the source code Preferences required: wikiplugin_map, feature_search
|
More detail for the | |
|
More detail for the | |
Note that this (x,y,z) order means longitude and latitude are the opposite way round to some map applications, such as Google Maps and Earth. |
Examples | |
Simple Example | |
This map shows all the tracker items from tracker #10. In its simplest form, the only thing a tracker item needs to appear on a map is a Location field with the "Use as item location" option set to "yes". Copy to clipboard
|
Slightly less simple real world example | |
This one combines the items from three trackers, #10 (for the points), #11 (paths and trails) and #12 (boundaries and zones. They each have the following fields:
This code: Copy to clipboard
Copy to clipboard
|
Using | |
Since Tiki9
Individual Copy to clipboard
More detail on the {searchlayer} parameters: |
Layers usage example 1 | |
Copy to clipboard
Copy to clipboard
|
Layers usage example 2 | |
Imagine that you want to allow an external web site (blogspot, or anywhere where iframes are accepted) to show a map generated in a tiki site, in a similar way to how you would add a google map. You could embed the external wiki page with the geolocated tracker items in a map through an iframe at the remote site. This type content below added to the wiki page will display a map in the page without showing the list of items (from tracker 16 in this example) below the map. And since the PluginAppframe is also used, no side columns will be displayed either, so that you could make an iframe with just the map of the page: Copy to clipboard
|
Creating map objects with the File option | |
Map objects can be defined in Tracker records: a simple POI can be defined using the Icon field type and the CartoGraf project then introduced the Geographic feature Tracker Field that allows paths (LineString) and boundaries (Polygon) to be drawn on a map and saved. Whilst the 'Geographic feature Tracker Field' method is very powerful it does have limitation so in 12.1 a new "Index As Map Layer" option (defaults to No) was added to the Files Tracker Field for an uploaded file (scroll to the end of the Options list in the tracker field set up screen to find this new one). This allows a file to be uploaded that is is then indexed and can therefore be added to a map. The file does have to very carefully conform to a standard XML-like format and a drop down list allows the selection of the file format to be either geoJSON or GPX - however the map projection must (at present) be EPSG:4326. This new capability overcomes the previous limitations with the Geographic feature Tracker Field. A tracker should either have the Files field or the Geographic feature Tracker Field. Note you may have to use "load_delay" to tweak the order of the "searchlayer" to display the elements that will be on the foreground and those on the background (IE: POI should be displayed over opaque or color filled boundaries). Using this File method any of the standard OpenLayer object types, LineString, MultiLineString, Polygon, MultPolygon, etc. can be used. |
Worked example with map objects | |
Since Tiki12
Some detailed notes on how the above worked example is createdThe following is the 'code' used: Copy to clipboard
In addition the following custom javascript is used to 'adjust' how OpenLayers displays the path 'lines' Copy to clipboard
Also:
|
Some other tips | |
Globally change stroke widthFor instance Copy to clipboard
Hide location field when location is not setIn some case you may have some items with a map location set and some items without.
Copy to clipboard
|
New OpenLayers Library Support (Tiki 20+) | |
In Tiki 20.1 support for newer OpenLayers versions has been added, now updated to ol5. A very experimental version was introduced in earlier Tikis but it wasn't reliable or usable. There is a preference for this on the maps control panel. This introduced:
|
Related pages | |
|
Aliases | |