Leaflet GeoJSON: Difference between revisions

From Maps for MediaWiki
mNo edit summary
(add another limitation)
(7 intermediate revisions by one other user not shown)
Line 3: Line 3:
Since [https://en.wikipedia.org/wiki/GeoJSON GeoJSON] is an open standard, there are many tools that allow you to create an consume GeoJson. A simple online visual map editor that outputs GeoJSON is [http://geojson.io geojson.io].
Since [https://en.wikipedia.org/wiki/GeoJSON GeoJSON] is an open standard, there are many tools that allow you to create an consume GeoJson. A simple online visual map editor that outputs GeoJSON is [http://geojson.io geojson.io].


== GeoJSON files ==
== In-wiki GeoJSON ==


<pre>
Since version 6.0, you can store your GeoJSON in wiki pages that are in the GeoJson namespace. For instance [[GeoJson:Berlin]]. You can use this GeoJSON via the <code>geojson</code> parameter, by giving it the page name. The GeoJSON stored in a page can be used by as many maps as you like.
{{#display_map: center=Berlin
  | geojson=https://raw.githubusercontent.com/leakyMirror/map-of-europe/master/GeoJSON/europe.geojson
}}
</pre>


{{#display_map: center=Berlin
<pre>{{#display_map: center=Berlin | geojson=Berlin}}</pre>
  | geojson=https://raw.githubusercontent.com/leakyMirror/map-of-europe/master/GeoJSON/europe.geojson
}}


== GeoJSON pages ==
{{#display_map: center=Berlin | geojson=Berlin | scrollzoom=off }}


Since version 6.0, you can store your GeoJSON in wiki pages that are in the GeoJson namespace. For instance [[GeoJson:Berlin]]. You can use this GeoJSON in the [[Extension:Maps/Displaying_maps|<code>#display_map</code>]] parser function via the <code>geojson</code> parameter, by giving it the page name. The GeoJSON stored in a page can be used by as many maps as you like.
The pages in the GeoJson namespace make sure they contain valid JSON. Once saved, the pages show a preview of the GeoJSON on a Leaflet map.


<pre>{{#display_map:Berlin|geojson=Berlin}}</pre>
=== Visual editor ===


{{#display_map:Berlin|geojson=Berlin}}
Since version 6.7 pages in the GeoJson namespace contain a [https://professional.wiki/en/news/visual-map-editor-for-mediawiki visual map editor]. The editor is only shown to those with permissions to edit the page.


The pages in the GeoJson namespace make sure they contain valid JSON. Once saved, the pages show a preview of the GeoJSON on a Leaflet map.
Since version 7.13 the editor is also shown on regular maps that use GeoJson.


== Visual editor ==
=== Semantic MediaWiki integration ===


Since version 6.7 pages in the GeoJson namespace contain a [https://professional.wiki/en/news/visual-map-editor-for-mediawiki visual map editor]. The editor is only shown to those with permissions to edit the page.
Since Maps version 7.16 there is experimental SMW integration that stores GeoJson data as SubObjects. Contact [[Jeroen De Dauw]] for more information.


Since version 1.13 the editor is also shown on regular maps that use GeoJson.
=== GeoJSON export ===


== Semantic MediaWiki integration ==
You can export GeoJSON stored on a GeoJSON page by clicking "edit" or "view source" and copying the content.


Since Maps version 7.16 there is experimental SMW integration that stores GeoJson data as SubObjects. Contact [[Jeroen De Dauw]] for more information.
Alternatively you can add <code>?action=raw</code> to the page URL. Example: [https://maps.extension.wiki/wiki/GeoJson:Berlin?action=raw GeoJson:Berlin?action=raw]


== Limitations ==
=== Limitations ===


As of version 7.16:
As of version 7.16:


* Only Leaflet supports GeoJson
* Marker styles cannot be changed
* Marker styles cannot be changed
* Images and links cannot be added to the markers
* No visual editing of shape styles
* No visual editing of shape styles
* Only Leaflet supports GeoJson
* Editing the GeoJSON page directly does not cause automatic updates on pages that make use of it
* No captcha integration: edits will fail for users that need to fill out a captcha to edit
* The preview maps on GeoJson pages cannot be customized via wikitext or configuration
* The preview maps on GeoJson pages cannot be customized via wikitext or configuration
* https://github.com/JeroenDeDauw/Maps/projects/1
* https://github.com/JeroenDeDauw/Maps/projects/1


You can hire [[Jeroen De Dauw]] (creator of Maps) to work on the above via [https://professional.wiki Professional.Wiki].
You can hire [[Jeroen De Dauw]] (creator of Maps) to work on the above via [https://professional.wiki Professional.Wiki].
== GeoJSON files ==
<pre>
{{#display_map: center=Berlin
| geojson = https://raw.githubusercontent.com/leakyMirror/map-of-europe/master/GeoJSON/europe.geojson
}}
</pre>
{{#display_map: center=Berlin
| geojson = https://raw.githubusercontent.com/leakyMirror/map-of-europe/master/GeoJSON/europe.geojson
| scrollzoom = off
}}


== See also ==
== See also ==


* [https://professional.wiki/en/news/visual-map-editor-for-mediawiki Visual Map Editor for MediaWiki] (blog post)
* [https://professional.wiki/en/news/visual-map-editor-for-mediawiki Visual Map Editor for MediaWiki] (blog post)
* [[Visual Leaflet editor]]
* [[KML export]]

Revision as of 14:06, 24 February 2022

Maps supports working with GeoJSON since version 6.

Since GeoJSON is an open standard, there are many tools that allow you to create an consume GeoJson. A simple online visual map editor that outputs GeoJSON is geojson.io.

In-wiki GeoJSON

Since version 6.0, you can store your GeoJSON in wiki pages that are in the GeoJson namespace. For instance GeoJson:Berlin. You can use this GeoJSON via the geojson parameter, by giving it the page name. The GeoJSON stored in a page can be used by as many maps as you like.

{{#display_map: center=Berlin | geojson=Berlin}}
Loading map...

The pages in the GeoJson namespace make sure they contain valid JSON. Once saved, the pages show a preview of the GeoJSON on a Leaflet map.

Visual editor

Since version 6.7 pages in the GeoJson namespace contain a visual map editor. The editor is only shown to those with permissions to edit the page.

Since version 7.13 the editor is also shown on regular maps that use GeoJson.

Semantic MediaWiki integration

Since Maps version 7.16 there is experimental SMW integration that stores GeoJson data as SubObjects. Contact Jeroen De Dauw for more information.

GeoJSON export

You can export GeoJSON stored on a GeoJSON page by clicking "edit" or "view source" and copying the content.

Alternatively you can add ?action=raw to the page URL. Example: GeoJson:Berlin?action=raw

Limitations

As of version 7.16:

  • Only Leaflet supports GeoJson
  • Marker styles cannot be changed
  • Images and links cannot be added to the markers
  • No visual editing of shape styles
  • Editing the GeoJSON page directly does not cause automatic updates on pages that make use of it
  • No captcha integration: edits will fail for users that need to fill out a captcha to edit
  • The preview maps on GeoJson pages cannot be customized via wikitext or configuration
  • https://github.com/JeroenDeDauw/Maps/projects/1

You can hire Jeroen De Dauw (creator of Maps) to work on the above via Professional.Wiki.

GeoJSON files

{{#display_map: center=Berlin
 | geojson = https://raw.githubusercontent.com/leakyMirror/map-of-europe/master/GeoJSON/europe.geojson
}}
Loading map...

See also