Support GeoJSON layers
This commit is contained in:
parent
79a8c6ab9a
commit
0e462aac86
1 changed files with 11 additions and 0 deletions
|
|
@ -348,6 +348,15 @@ BR.LayersConfig = L.Class.extend({
|
|||
}
|
||||
},
|
||||
|
||||
createGeoJsonLayer: function (props) {
|
||||
const layer = L.geoJSON(undefined);
|
||||
fetch(props.url).then(async (response) => {
|
||||
const geojson = await response.json();
|
||||
layer.addData(geojson);
|
||||
});
|
||||
return layer;
|
||||
},
|
||||
|
||||
createLayer: function (layerData) {
|
||||
var props = layerData.properties;
|
||||
var url = props.url;
|
||||
|
|
@ -436,6 +445,8 @@ BR.LayersConfig = L.Class.extend({
|
|||
layer = this.createOpenStreetMapNotesLayer();
|
||||
} else if (props.type === 'mvt') {
|
||||
layer = this.createMvtLayer(props, options);
|
||||
} else if (props.type === 'geojson') {
|
||||
layer = this.createGeoJsonLayer(props);
|
||||
} else {
|
||||
// JOSM
|
||||
var josmUrl = url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue