vue-geojson-view-ts 1.2.3 → 1.2.5
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 +202 -193
- package/dist/vue-geojson-view-ts.umd.cjs +3 -3
- package/package.json +1 -1
- package/src/components/MapView.vue +30 -18
package/package.json
CHANGED
|
@@ -198,6 +198,7 @@ export default defineComponent({
|
|
|
198
198
|
},
|
|
199
199
|
viewMap(): void {
|
|
200
200
|
const iconDefaultMarket = this.configurationMap?this.configurationMap.iconMarker?this.configurationMap.iconMarker:this.markerIcon:this.markerIcon
|
|
201
|
+
window.type = true
|
|
201
202
|
const map = L.map(this.idMap).setView([this.renderCoordinates?this.renderCoordinates[0] as number:0,this.renderCoordinates?this.renderCoordinates[1] as number:0],this.renderCoordinates?this.renderCoordinates[2]as number:0);
|
|
202
203
|
//const map = L.map(this.idMap,{minZoom: 15,maxZoom: 500}).setView([this.renderCoordinates?this.renderCoordinates[0] as number:0,this.renderCoordinates?this.renderCoordinates[1] as number:0],this.renderCoordinates?this.renderCoordinates[2]as number:0);
|
|
203
204
|
this.mapRender = map;
|
|
@@ -221,6 +222,35 @@ export default defineComponent({
|
|
|
221
222
|
remove: this.configurationMap?.editFigures.remove
|
|
222
223
|
}
|
|
223
224
|
}
|
|
225
|
+
|
|
226
|
+
const renderGeojson = this.renderGeojson;
|
|
227
|
+
if (renderGeojson && renderGeojson.length) {
|
|
228
|
+
renderGeojson.forEach((item: any) => {
|
|
229
|
+
if (item.type === 'FeatureCollection') {
|
|
230
|
+
item.features.forEach((feature: any) => {
|
|
231
|
+
if (feature.geometry.type === 'Polygon' || feature.geometry.type === 'MultiPolygon') {
|
|
232
|
+
//L.geoJSON(feature).addTo(featureGroup);
|
|
233
|
+
L.geoJson(feature, {
|
|
234
|
+
onEachFeature: function (feature, layer) {
|
|
235
|
+
featureGroup.addLayer(layer);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
} else if (item.type === 'Feature') {
|
|
241
|
+
if (item.geometry.type === 'Polygon' || item.geometry.type === 'MultiPolygon') {
|
|
242
|
+
//L.geoJSON(item).addTo(featureGroup);
|
|
243
|
+
L.geoJson(item, {
|
|
244
|
+
onEachFeature: function (feature, layer) {
|
|
245
|
+
featureGroup.addLayer(layer);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const bounds = featureGroup.getBounds();
|
|
252
|
+
map.fitBounds(bounds);
|
|
253
|
+
}
|
|
224
254
|
const drawControl = new L.Control.Draw({
|
|
225
255
|
position: "topleft",
|
|
226
256
|
draw: {
|
|
@@ -240,24 +270,6 @@ export default defineComponent({
|
|
|
240
270
|
edit: contextEdit as any
|
|
241
271
|
});
|
|
242
272
|
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
273
|
|
|
262
274
|
map.on('draw:created', (event:any) => {
|
|
263
275
|
const layer = event.layer;
|