]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/commitdiff
Better description of the GeoJSON format.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 25 Nov 2023 10:42:57 +0000 (11:42 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 25 Nov 2023 10:42:57 +0000 (11:42 +0100)
readme.md

index 290dccaad3c5e618608fbc0def7fc375373618fe..84f1bbe106c0309b42d1d3fa2e732d5534409e30 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -4,9 +4,12 @@ This MediaWiki extension creates a map using OpenLayers to show sledrun details
 It is developed for https://www.winterrodeln.org/
 This extension depends on no other extension.
 
+There is a legacy tag `<wrmap>` to define maps. The new map format is GeoJSON.
 
-Example 1
----------
+
+## Definition of `<wrmap`>
+
+### Example 1
 
 ```xml
 <wrgmap lat="47.267648" lon="11.40465" zoom="10"/>
@@ -16,8 +19,7 @@ Shows icons for all sledruns. `lat`, `lon` and `zoom` are optional.
 
 
 
-Example 2
----------
+### Example 2
 
 ```xml
 <wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
@@ -108,15 +110,14 @@ Example 2
 ```
 
 
-Definition
-----------
+### Definition of `<wrmap`>
 
 * `<wrmap>...</wrmap>` has to be valid XML.
 * All coordinates are in WGS84 coordinate system.
 * Coordinates have the preferred format "latitude N longitude E", however for parsing the N and E can be omitted.
 * <wrmap> has the following attributes:
-    * `lat` (float): latitude of map-center, optional.
-    * `lon` (float): longitude of map-center, optional.
+    * `lat` (float): latitude of map-center, WGS84, optional.
+    * `lon` (float): longitude of map-center, WGS84, optional.
     * `zoom` (integer): zoom level of the map (google zoom levels). optional.
     * `width` (integer): width of the map in pixel. optional (100% if omitted)
     * `height` (integer): height of the map in pixel. optional.
@@ -147,15 +148,22 @@ Definition
     * The content of the elements are a whitespace separated list of coordinates.
 
 
-For transmitting the map to javascript, geojson is used in the `<div>` element of the map.
-This way, an extra request is avoided. The geojson format used here consists of a single
+### Transmitting `<wrmap>` with GeoJSON
+
+For transmitting the map to javascript, GeoJSON is used in the `<div>` element of the map as described below.
+This way, an extra request is avoided. The GeoJSON format used here consists of a single
 "FeatureCollection" (representing the `<wrmap>`) containing the sub-elements of wrmap
 as features.
-The features have an properties key that has a hash as values with the properties of
-the XML subelements of wrmap. Optional attributes/properties can be omitted.
-Additionally one mandatory property key is called 'type' and has the sub-element's name
-as value.
-The featurecollection itself has a properties key as well containing the attributes of
+
+
+## GeoJSON
+
+The GeoJSON format consists of a single "FeatureCollection" (representing the `<wrmap>` of the legacy format) containing the sub-elements of `<wrmap>` as features.
+
+The features have a GeoJSON `properties` object with the properties corresonding to the XML subelements of the legacy `wrmap` as described above. Optional attributes/properties can be omitted.
+One mandatory property entry is called `type` and has the sub-element's name
+as value (like `Rodelbahn`.)
+The featurecollection itself has an extra field called `wr_properties` containing the attributes of
 the wrmap element.