[TASK] Add GeoJSON support

JSON needs to be added as array in config.js oder config.default.js
It needs a json and a option part (for style)

e.g.
geo: [
      {
        json: [
          {
            'type': 'Feature',
            'geometry': {
              'type': 'Polygon',
              'coordinates': [
                [
                  [
                    12.04925537109375,
                    49.036517514836994
                  ],
                  [
                    12.033462524414062,
                    49.021660359632115
                  ],
                  [
                    12.058181762695312,
                    48.99553703238219
                  ],
                  [
                    12.11311340332031,
                    49.001843917978526
                  ],
                  [
                    12.122726440429686,
                    49.03381654386847
                  ],
                  [
                    12.04925537109375,
                    49.036517514836994
                  ]
                ]
              ]
            }
          }
        ],
        option: {
          style: {
            color: '#e23535',
            weight: 5,
            opacity: 0.4,
            fillColor: '#6de922',
            fillOpacity: 0.1
          }
        }
      }
    ]
This commit is contained in:
Xaver Maierhofer 2018-07-27 20:02:19 +02:00
parent bfb1111744
commit 4fd4e27a8b
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8

View File

@ -84,6 +84,12 @@ define(['map/clientlayer', 'map/labellayer', 'map/button', 'leaflet', 'map/activ
map.on('dragend', saveView); map.on('dragend', saveView);
map.on('contextmenu', contextMenuOpenLayerMenu); map.on('contextmenu', contextMenuOpenLayerMenu);
if (config.geo) {
[].forEach.call(config.geo, function (geo) {
L.geoJSON(geo.json, geo.option).addTo(map);
});
}
button.init(); button.init();
layerControl = L.control.layers(baseLayers, [], { position: 'bottomright' }); layerControl = L.control.layers(baseLayers, [], { position: 'bottomright' });