vue-geojson-view-ts 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-geojson-view-ts.js +200 -193
- package/dist/vue-geojson-view-ts.umd.cjs +3 -3
- package/package.json +1 -1
- package/src/components/MapView.vue +30 -19
package/package.json
CHANGED
|
@@ -90,7 +90,7 @@ export default defineComponent({
|
|
|
90
90
|
this.featuresData.eachLayer((layer:any) => {
|
|
91
91
|
geojson.addLayer(layer);
|
|
92
92
|
});
|
|
93
|
-
const geojsonString = JSON.stringify(geojson.toGeoJSON());
|
|
93
|
+
const geojsonString = JSON.stringify([geojson.toGeoJSON()]);
|
|
94
94
|
return geojsonString
|
|
95
95
|
},
|
|
96
96
|
triggerSaveEdit():void{
|
|
@@ -221,6 +221,35 @@ export default defineComponent({
|
|
|
221
221
|
remove: this.configurationMap?.editFigures.remove
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
|
|
225
|
+
const renderGeojson = this.renderGeojson;
|
|
226
|
+
if (renderGeojson && renderGeojson.length) {
|
|
227
|
+
renderGeojson.forEach((item: any) => {
|
|
228
|
+
if (item.type === 'FeatureCollection') {
|
|
229
|
+
item.features.forEach((feature: any) => {
|
|
230
|
+
if (feature.geometry.type === 'Polygon' || feature.geometry.type === 'MultiPolygon') {
|
|
231
|
+
//L.geoJSON(feature).addTo(featureGroup);
|
|
232
|
+
L.geoJson(feature, {
|
|
233
|
+
onEachFeature: function (feature, layer) {
|
|
234
|
+
featureGroup.addLayer(layer);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
} else if (item.type === 'Feature') {
|
|
240
|
+
if (item.geometry.type === 'Polygon' || item.geometry.type === 'MultiPolygon') {
|
|
241
|
+
//L.geoJSON(item).addTo(featureGroup);
|
|
242
|
+
L.geoJson(item, {
|
|
243
|
+
onEachFeature: function (feature, layer) {
|
|
244
|
+
featureGroup.addLayer(layer);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
const bounds = featureGroup.getBounds();
|
|
251
|
+
map.fitBounds(bounds);
|
|
252
|
+
}
|
|
224
253
|
const drawControl = new L.Control.Draw({
|
|
225
254
|
position: "topleft",
|
|
226
255
|
draw: {
|
|
@@ -240,24 +269,6 @@ export default defineComponent({
|
|
|
240
269
|
edit: contextEdit as any
|
|
241
270
|
});
|
|
242
271
|
map.addControl(drawControl);
|
|
243
|
-
const renderGeojson = this.renderGeojson;
|
|
244
|
-
if (renderGeojson && renderGeojson.length) {
|
|
245
|
-
renderGeojson.forEach((item: any) => {
|
|
246
|
-
if (item.type === 'FeatureCollection') {
|
|
247
|
-
item.features.forEach((feature: any) => {
|
|
248
|
-
if (feature.geometry.type === 'Polygon' || feature.geometry.type === 'MultiPolygon') {
|
|
249
|
-
L.geoJSON(feature).addTo(featureGroup);
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
} else if (item.type === 'Feature') {
|
|
253
|
-
if (item.geometry.type === 'Polygon' || item.geometry.type === 'MultiPolygon') {
|
|
254
|
-
L.geoJSON(item).addTo(featureGroup);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
const bounds = featureGroup.getBounds();
|
|
259
|
-
map.fitBounds(bounds);
|
|
260
|
-
}
|
|
261
272
|
|
|
262
273
|
map.on('draw:created', (event:any) => {
|
|
263
274
|
const layer = event.layer;
|