3 This MediaWiki extension creates a map using OpenLayers to show sledrun details and sledrun overviews.
4 It is developed for https://www.winterrodeln.org/
5 This extension depends on no other extension.
7 There is a legacy tag `<wrmap>` to define maps. The new map format is GeoJSON.
10 ## Definition of `<wrmap`>
15 <wrgmap lat="47.267648" lon="11.40465" zoom="10"/>
18 Shows icons for all sledruns. `lat`, `lon` and `zoom` are optional.
25 <wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
27 <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
28 <gasthaus name="Stiglreith">47.238186 11.221940</gasthaus>
29 <gasthaus name="Sulzstich">47.240287 11.203006</gasthaus>
30 <parkplatz>47.245789 11.238971</parkplatz>
31 <parkplatz>47.237627 11.218886</parkplatz>
32 <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
33 <achtung name="Kreuzung mit Schipiste">47.2383200 11.2235592</achtung>
113 ### Definition of `<wrmap`>
115 * `<wrmap>...</wrmap>` has to be valid XML.
116 * All coordinates are in WGS84 coordinate system.
117 * Coordinates have the preferred format "latitude N longitude E", however for parsing the N and E can be omitted.
118 * <wrmap> has the following attributes:
119 * `lat` (float): latitude of map-center, WGS84, optional.
120 * `lon` (float): longitude of map-center, WGS84, optional.
121 * `zoom` (integer): zoom level of the map (google zoom levels). optional.
122 * `width` (integer): width of the map in pixel. optional (100% if omitted)
123 * `height` (integer): height of the map in pixel. optional.
124 * `<wrmap>` can have any number of the following sub-elements:
138 * The order may be used by the renderer to determine in which order the elements should be drawn: First mentioned elements are drawn first.
139 * `<gasthaus>`, `<haltestelle>`, `<parkplatz>`, `<achtung>`, `<foto>`, `<verleih>` and `<punkt>` define points
140 * The elements may have the following attributes:
141 * `name` (string): defines the name (not the label) of the element
142 * `wiki` (string): name of a MediaWiki page the point refers to
143 * The content is exactly one coordinate pair.
144 * `<rodelbahn>`, `<alternative>`, `<gehweg>`, `<lift>`, `<anfahrt>` and `<linie>` define non-closed polygons.
145 * They may have the following attributes:
146 * `farbe` (hex format, e.g. `#12a50f`): color of the line
147 * `dicke` (int): width of the line in pixel
148 * The content of the elements are a whitespace separated list of coordinates.
151 ### Transmitting `<wrmap>` with GeoJSON
153 For transmitting the map to javascript, GeoJSON is used in the `<div>` element of the map as described below.
154 This way, an extra request is avoided. The GeoJSON format used here consists of a single
155 "FeatureCollection" (representing the `<wrmap>`) containing the sub-elements of wrmap
161 The GeoJSON format consists of a single "FeatureCollection" (representing the `<wrmap>` of the legacy format) containing the sub-elements of `<wrmap>` as features.
163 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.
164 One mandatory property entry is called `type` and has the sub-element's name
165 as value (like `Rodelbahn`.)
166 The featurecollection itself has an extra field called `wr_properties` containing the attributes of
170 ## Install build dependencies
172 The following command uses `package.json` to install all dependencies
178 ## Bundle JavaScript/Typescript
180 The TypeScript source files are below the src directory.
185 Add `/*@nomin*/` close to the end of `dist/wrmap.mjs` to prevent minification bug: https://phabricator.wikimedia.org/T351610.