From ac7849451c9c6891a66e151f20da9f7d00f44db6 Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Sat, 25 Nov 2023 11:42:57 +0100 Subject: [PATCH] Better description of the GeoJSON format. --- readme.md | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/readme.md b/readme.md index 290dcca..84f1bbe 100644 --- 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 `` to define maps. The new map format is GeoJSON. -Example 1 ---------- + +## Definition of ` + +### Example 1 ```xml @@ -16,8 +19,7 @@ Shows icons for all sledruns. `lat`, `lon` and `zoom` are optional. -Example 2 ---------- +### Example 2 ```xml @@ -108,15 +110,14 @@ Example 2 ``` -Definition ----------- +### Definition of ` * `...` 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. * 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 `
` element of the map. -This way, an extra request is avoided. The geojson format used here consists of a single +### Transmitting `` with GeoJSON + +For transmitting the map to javascript, GeoJSON is used in the `
` 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 ``) 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 `` of the legacy format) containing the sub-elements of `` 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. -- 2.39.5