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"/>
-Example 2
----------
+### Example 2
```xml
<wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
```
-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.
* 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.
+
+
+## Install build dependencies
+
+The following command uses `package.json` to install all dependencies
+
+ npm install
+
+
+
+## Bundle JavaScript/Typescript
+
+The TypeScript source files are below the src directory.
+To bundle them, run
+
+ npm run build
+
+Add `/*@nomin*/` close to the end of `dist/wrmap.mjs` to prevent minification bug: https://phabricator.wikimedia.org/T351610.