]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/commitdiff
Rename "properties" of geojson to "wr_properties".
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 19 Nov 2023 16:54:55 +0000 (17:54 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 19 Nov 2023 16:54:55 +0000 (17:54 +0100)
src/wrmap.ts
wrmap.body.php

index 7e720bf15d4dd25a3c5ee4221f1258bd64bd84f1..7cec3e29fb81eb411e7e5db493426e59a6dcee7f 100644 (file)
@@ -273,14 +273,11 @@ function init_wrmap(_: number, jq_map_element: HTMLElement) {
 
        // map itself
        // ----------
-       let lon = json_js.properties.lon;
-       let lat = json_js.properties.lat;
-       let zoom = json_js.properties.zoom;
-       let width = json_js.properties.width;
-       let height = json_js.properties.height;
-       if (zoom === undefined) zoom = 10; // default zoom
-       if (width === undefined) width = '100%'; // default width
-       if (height === undefined) height = 450;  // default: 450 pixel
+       let lon = json_js.wr_properties?.lon ?? 11.;
+       let lat = json_js.wr_properties?.lat ?? 47.;
+       let zoom = json_js.wr_properties?.zoom ?? 10;
+       let width = json_js.wr_properties?.width ?? '100%';
+       let height = json_js.properties?.height ?? 450;
        jq_map.width(width);
        jq_map.height(height);
 
index 78669649af178cf5edd711f3682e1ecb847a1f66..fa4bd4162854de91a9d3de413e5ade176ef3cb41 100644 (file)
@@ -271,7 +271,7 @@ class WrBaseMap {
                $json = array(
                        'type' => 'FeatureCollection',
                        'features' => $json_features,
-                       'properties' => $properties
+                       'wr_properties' => $properties
                );
                $json_string = json_encode($json);