]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/blob - readme.md
Synchronize version numbers.
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / readme.md
1 # WrMap
2
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.
6
7
8 Example 1
9 ---------
10
11 ```xml
12 <wrgmap lat="47.267648" lon="11.40465" zoom="10"/>
13 ```
14
15 Shows icons for all sledruns. `lat`, `lon` and `zoom` are optional.
16
17
18
19 Example 2
20 ---------
21
22 ```xml
23 <wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
24
25 <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
26 <gasthaus name="Stiglreith">47.238186 11.221940</gasthaus>
27 <gasthaus name="Sulzstich">47.240287 11.203006</gasthaus>
28 <parkplatz>47.245789 11.238971</parkplatz>
29 <parkplatz>47.237627 11.218886</parkplatz>
30 <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
31 <achtung name="Kreuzung mit Schipiste">47.2383200 11.2235592</achtung>
32
33 <gehweg>
34 47.238587 11.203360
35 47.239743 11.203522
36 47.240135 11.203247
37 </gehweg>
38
39 <gehweg>
40 47.238442 11.203263
41 47.237799 11.203511
42 47.237133 11.202988
43 47.238091 11.206642
44 47.237273 11.211675
45 47.237133 11.214466
46 47.237513 11.218199
47 </gehweg>
48
49 <alternative>
50 47.240487 11.190169
51 47.238996 11.188628
52 47.238987 11.188018
53 47.238267 11.187075
54 47.238461 11.190511
55 47.239751 11.191795
56 47.240037 11.192702
57 47.239525 11.193535
58 47.239688 11.194272
59 47.239017 11.193925
60 47.239536 11.195457
61 47.240063 11.196230
62 47.240747 11.196658
63 47.239734 11.198295
64 47.238857 11.198346
65 47.237743 11.199778
66 47.238250 11.202755
67 47.238587 11.203360
68 </alternative>
69
70 <rodelbahn>
71 47.238587 11.203360
72 47.238185 11.203982
73 47.238297 11.204381
74 47.239417 11.204972
75 47.239210 11.208772
76 47.238999 11.209523
77 47.239126 11.209839
78 47.238933 11.210641
79 47.239102 11.210739
80 47.238666 11.215042
81 47.238203 11.216089
82 47.238183 11.218151
83 47.237851 11.218599
84 47.238055 11.219755
85 47.237686 11.222441
86 47.238000 11.223367
87 47.238625 11.223687
88 47.239915 11.223118
89 47.240992 11.219781
90 47.243412 11.214141
91 47.243207 11.218331
92 47.243990 11.216205
93 47.243785 11.223251
94 47.242845 11.228510
95 47.242917 11.232501
96 47.242524 11.235001
97 47.244737 11.231791
98 47.244951 11.230868
99 47.245470 11.237853
100 </rodelbahn>
101
102 <lift>
103 47.245656 11.237286
104 47.238189 11.221344
105 </lift>
106
107 </wrmap>
108 ```
109
110
111 Definition
112 ----------
113
114 * `<wrmap>...</wrmap>` has to be valid XML.
115 * All coordinates are in WGS84 coordinate system.
116 * Coordinates have the preferred format "latitude N longitude E", however for parsing the N and E can be omitted.
117 * <wrmap> has the following attributes:
118     * `lat` (float): latitude of map-center, optional.
119     * `lon` (float): longitude of map-center, optional.
120     * `zoom` (integer): zoom level of the map (google zoom levels). optional.
121     * `width` (integer): width of the map in pixel. optional (100% if omitted)
122     * `height` (integer): height of the map in pixel. optional.
123     * `<wrmap>` can have any number of the following sub-elements:
124         * `<gasthaus>`
125         * `<haltestelle>`
126         * `<parkplatz>`
127         * `<achtung>`
128         * `<foto>`
129         * `<verleih>`
130         * `<punkt>`
131         * `<rodelbahn>`
132         * `<alternative>`
133         * `<gehweg>`
134         * `<lift>`
135         * `<anfahrt>`
136         * `<linie>`
137         * The order may be used by the renderer to determine in which order the elements should be drawn: First mentioned elements are drawn first.
138 * `<gasthaus>`, `<haltestelle>`, `<parkplatz>`, `<achtung>`, `<foto>`, `<verleih>` and `<punkt>` define points
139     * The elements may have the following attributes:
140         * `name` (string): defines the name (not the label) of the element
141         * `wiki` (string): name of a MediaWiki page the point refers to
142     * The content is exactly one coordinate pair.
143 * `<rodelbahn>`, `<alternative>`, `<gehweg>`, `<lift>`, `<anfahrt>` and `<linie>` define non-closed polygons.
144     * They may have the following attributes:
145         * `farbe` (hex format, e.g. `#12a50f`): color of the line
146         * `dicke` (int): width of the line in pixel
147     * The content of the elements are a whitespace separated list of coordinates.
148
149
150 For transmitting the map to javascript, geojson is used in the `<div>` element of the map.
151 This way, an extra request is avoided. The geojson format used here consists of a single
152 "FeatureCollection" (representing the `<wrmap>`) containing the sub-elements of wrmap
153 as features.
154 The features have an properties key that has a hash as values with the properties of
155 the XML subelements of wrmap. Optional attributes/properties can be omitted.
156 Additionally one mandatory property key is called 'type' and has the sub-element's name
157 as value.
158 The featurecollection itself has a properties key as well containing the attributes of
159 the wrmap element.
160
161
162 ## Install build dependencies
163
164 The following command uses `package.json` to install all dependencies
165
166     npm install
167
168
169
170 ## Bundle JavaScript/Typescript
171
172 The TypeScript source files are below the src directory.
173 To bundle them, run
174
175     npm run build