vue-geojson-view-ts 1.3.8 → 1.3.9
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/components/MapView.vue.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/vue-geojson-view-ts.js +10357 -10239
- package/dist/vue-geojson-view-ts.umd.cjs +30 -30
- package/package.json +1 -1
- package/src/components/MapHeatComponent.vue +0 -2
- package/src/components/MapView.vue +130 -16
package/package.json
CHANGED
|
@@ -199,7 +199,6 @@ export default defineComponent({
|
|
|
199
199
|
},
|
|
200
200
|
methods: {
|
|
201
201
|
changeTypeMap(type: string) {
|
|
202
|
-
this.type = type;
|
|
203
202
|
if (type === "0") {
|
|
204
203
|
this.heatLayer.setVisible(true);
|
|
205
204
|
this.pointLayer.setVisible(false);
|
|
@@ -330,7 +329,6 @@ export default defineComponent({
|
|
|
330
329
|
return false;
|
|
331
330
|
},
|
|
332
331
|
async onClickListener(event: any) {
|
|
333
|
-
this.changeTypeMap("1");
|
|
334
332
|
const content: any = document.getElementById("popup-content");
|
|
335
333
|
const closer: any = document.getElementById("popup-closer");
|
|
336
334
|
|
|
@@ -13,8 +13,8 @@ import "leaflet/dist/leaflet.css";
|
|
|
13
13
|
import "leaflet-draw/dist/leaflet.draw.css";
|
|
14
14
|
import drawLocales from "leaflet-draw-locales";
|
|
15
15
|
import axios from "axios";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
16
|
+
import "leaflet.fullscreen/Control.FullScreen.css";
|
|
17
|
+
import "leaflet.fullscreen";
|
|
18
18
|
|
|
19
19
|
declare global {
|
|
20
20
|
interface Window {
|
|
@@ -136,7 +136,7 @@ export default defineComponent({
|
|
|
136
136
|
: this.markerIcon
|
|
137
137
|
: this.markerIcon;
|
|
138
138
|
window.type = true;
|
|
139
|
-
const map = L.map(this.idMap,{fullscreenControl:true} as any).setView(
|
|
139
|
+
const map = L.map(this.idMap, { fullscreenControl: true } as any).setView(
|
|
140
140
|
[
|
|
141
141
|
this.renderCoordinates ? (this.renderCoordinates[0] as number) : 0,
|
|
142
142
|
this.renderCoordinates ? (this.renderCoordinates[1] as number) : 0,
|
|
@@ -203,8 +203,14 @@ export default defineComponent({
|
|
|
203
203
|
icon: L.icon(iconDefaultMarket),
|
|
204
204
|
}
|
|
205
205
|
: false,
|
|
206
|
-
polyline:
|
|
207
|
-
|
|
206
|
+
polyline: this.configurationMap?.createFigures.polyline
|
|
207
|
+
? {
|
|
208
|
+
shapeOptions: {
|
|
209
|
+
color: "blue",
|
|
210
|
+
},
|
|
211
|
+
}
|
|
212
|
+
: false,
|
|
213
|
+
circlemarker: this.configurationMap?.createFigures.multipoint,
|
|
208
214
|
},
|
|
209
215
|
edit: contextEdit as any,
|
|
210
216
|
});
|
|
@@ -213,7 +219,37 @@ export default defineComponent({
|
|
|
213
219
|
map.on("draw:created", (event: any) => {
|
|
214
220
|
const layer = event.layer;
|
|
215
221
|
featureGroup.addLayer(layer);
|
|
216
|
-
|
|
222
|
+
let geojson = layer.toGeoJSON();
|
|
223
|
+
// *** AGREGADO: Manejo especial para CircleMarker (convertir a MultiPoint) ***
|
|
224
|
+
if (event.layerType === "circlemarker") {
|
|
225
|
+
// Convertir CircleMarker a formato MultiPoint para consistencia
|
|
226
|
+
geojson = {
|
|
227
|
+
type: "Feature",
|
|
228
|
+
geometry: {
|
|
229
|
+
type: "MultiPoint",
|
|
230
|
+
coordinates: [geojson.geometry.coordinates],
|
|
231
|
+
},
|
|
232
|
+
properties: {
|
|
233
|
+
...geojson.properties,
|
|
234
|
+
pointType: "multipoint",
|
|
235
|
+
style: {
|
|
236
|
+
color:
|
|
237
|
+
this.configurationMap?.createFigures?.multipoint?.color ||
|
|
238
|
+
"green",
|
|
239
|
+
fillColor:
|
|
240
|
+
this.configurationMap?.createFigures?.multipoint?.fillColor ||
|
|
241
|
+
"green",
|
|
242
|
+
fillOpacity:
|
|
243
|
+
this.configurationMap?.createFigures?.multipoint
|
|
244
|
+
?.fillOpacity || 0.8,
|
|
245
|
+
radius:
|
|
246
|
+
this.configurationMap?.createFigures?.multipoint?.radius || 6,
|
|
247
|
+
weight:
|
|
248
|
+
this.configurationMap?.createFigures?.multipoint?.weight || 2,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
}
|
|
217
253
|
if (this.getGeoJSON) this.getGeoJSON([geojson]);
|
|
218
254
|
});
|
|
219
255
|
|
|
@@ -232,17 +268,15 @@ export default defineComponent({
|
|
|
232
268
|
: this.markerIcon
|
|
233
269
|
: this.markerIcon;
|
|
234
270
|
window.type = true;
|
|
235
|
-
const map = L.map(this.idMap,{fullscreenControl:true} as any).setView(
|
|
271
|
+
const map = L.map(this.idMap, { fullscreenControl: true } as any).setView(
|
|
236
272
|
[
|
|
237
273
|
this.renderCoordinates ? (this.renderCoordinates[0] as number) : 0,
|
|
238
274
|
this.renderCoordinates ? (this.renderCoordinates[1] as number) : 0,
|
|
239
275
|
],
|
|
240
276
|
this.renderCoordinates ? (this.renderCoordinates[2] as number) : 0
|
|
241
277
|
);
|
|
242
|
-
//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);
|
|
243
278
|
this.mapRender = map;
|
|
244
279
|
L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
245
|
-
//maxZoom: 120,//this.configurationMap?.maxZoom,
|
|
246
280
|
attribution:
|
|
247
281
|
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
248
282
|
}).addTo(map);
|
|
@@ -270,10 +304,14 @@ export default defineComponent({
|
|
|
270
304
|
item.features.forEach((feature: any) => {
|
|
271
305
|
if (
|
|
272
306
|
feature.geometry.type === "Polygon" ||
|
|
273
|
-
feature.geometry.type === "MultiPolygon"
|
|
307
|
+
feature.geometry.type === "MultiPolygon" ||
|
|
308
|
+
feature.geometry.type === "LineString" ||
|
|
309
|
+
feature.geometry.type === "MultiLineString" ||
|
|
310
|
+
feature.geometry.type === "Point" ||
|
|
311
|
+
feature.geometry.type === "MultiPoint"
|
|
274
312
|
) {
|
|
275
|
-
//L.geoJSON(feature).addTo(featureGroup);
|
|
276
313
|
L.geoJson(feature, {
|
|
314
|
+
pointToLayer: this.getPointToLayer.bind(this),
|
|
277
315
|
onEachFeature: function (feature, layer) {
|
|
278
316
|
featureGroup.addLayer(layer);
|
|
279
317
|
},
|
|
@@ -283,9 +321,12 @@ export default defineComponent({
|
|
|
283
321
|
} else if (item.type === "Feature") {
|
|
284
322
|
if (
|
|
285
323
|
item.geometry.type === "Polygon" ||
|
|
286
|
-
item.geometry.type === "MultiPolygon"
|
|
324
|
+
item.geometry.type === "MultiPolygon" ||
|
|
325
|
+
item.geometry.type === "LineString" ||
|
|
326
|
+
item.geometry.type === "MultiLineString" ||
|
|
327
|
+
item.geometry.type === "Point" ||
|
|
328
|
+
item.geometry.type === "MultiPoint"
|
|
287
329
|
) {
|
|
288
|
-
//L.geoJSON(item).addTo(featureGroup);
|
|
289
330
|
L.geoJson(item, {
|
|
290
331
|
onEachFeature: function (feature, layer) {
|
|
291
332
|
featureGroup.addLayer(layer);
|
|
@@ -314,8 +355,14 @@ export default defineComponent({
|
|
|
314
355
|
icon: L.icon(iconDefaultMarket),
|
|
315
356
|
}
|
|
316
357
|
: false,
|
|
317
|
-
polyline:
|
|
318
|
-
|
|
358
|
+
polyline: this.configurationMap?.createFigures.polyline
|
|
359
|
+
? {
|
|
360
|
+
shapeOptions: {
|
|
361
|
+
color: "blue",
|
|
362
|
+
},
|
|
363
|
+
}
|
|
364
|
+
: false,
|
|
365
|
+
circlemarker: this.configurationMap?.createFigures.multipoint,
|
|
319
366
|
},
|
|
320
367
|
edit: contextEdit as any,
|
|
321
368
|
});
|
|
@@ -324,7 +371,37 @@ export default defineComponent({
|
|
|
324
371
|
map.on("draw:created", (event: any) => {
|
|
325
372
|
const layer = event.layer;
|
|
326
373
|
featureGroup.addLayer(layer);
|
|
327
|
-
|
|
374
|
+
let geojson = layer.toGeoJSON();
|
|
375
|
+
// *** AGREGADO: Manejo especial para CircleMarker (convertir a MultiPoint) ***
|
|
376
|
+
if (event.layerType === "circlemarker") {
|
|
377
|
+
// Convertir CircleMarker a formato MultiPoint para consistencia
|
|
378
|
+
geojson = {
|
|
379
|
+
type: "Feature",
|
|
380
|
+
geometry: {
|
|
381
|
+
type: "MultiPoint",
|
|
382
|
+
coordinates: [geojson.geometry.coordinates],
|
|
383
|
+
},
|
|
384
|
+
properties: {
|
|
385
|
+
...geojson.properties,
|
|
386
|
+
pointType: "multipoint",
|
|
387
|
+
style: {
|
|
388
|
+
color:
|
|
389
|
+
this.configurationMap?.createFigures?.multipoint?.color ||
|
|
390
|
+
"green",
|
|
391
|
+
fillColor:
|
|
392
|
+
this.configurationMap?.createFigures?.multipoint?.fillColor ||
|
|
393
|
+
"green",
|
|
394
|
+
fillOpacity:
|
|
395
|
+
this.configurationMap?.createFigures?.multipoint
|
|
396
|
+
?.fillOpacity || 0.8,
|
|
397
|
+
radius:
|
|
398
|
+
this.configurationMap?.createFigures?.multipoint?.radius || 6,
|
|
399
|
+
weight:
|
|
400
|
+
this.configurationMap?.createFigures?.multipoint?.weight || 2,
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
}
|
|
328
405
|
if (this.getGeoJSON) this.getGeoJSON(geojson);
|
|
329
406
|
});
|
|
330
407
|
|
|
@@ -336,6 +413,43 @@ export default defineComponent({
|
|
|
336
413
|
});
|
|
337
414
|
});
|
|
338
415
|
},
|
|
416
|
+
getPointToLayer(feature: any, latlng: any) {
|
|
417
|
+
const geometryType = feature.geometry?.type;
|
|
418
|
+
|
|
419
|
+
// Si es Point o MultiPoint
|
|
420
|
+
if (geometryType === "Point" || geometryType === "MultiPoint") {
|
|
421
|
+
// Si multipoint está habilitado, usar circleMarker con opciones personalizadas
|
|
422
|
+
if (this.configurationMap?.createFigures?.multipoint) {
|
|
423
|
+
const multipointOpts = this.configurationMap.createFigures.multipoint;
|
|
424
|
+
return L.circleMarker(latlng, {
|
|
425
|
+
color: multipointOpts.color || "green",
|
|
426
|
+
fillColor: multipointOpts.fillColor || "green",
|
|
427
|
+
fillOpacity: multipointOpts.fillOpacity ?? 0.8,
|
|
428
|
+
radius: multipointOpts.radius ?? 6,
|
|
429
|
+
weight: multipointOpts.weight ?? 2,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Si marker está habilitado, usar icono personalizado
|
|
434
|
+
if (this.configurationMap?.createFigures?.marker) {
|
|
435
|
+
return L.marker(latlng, {
|
|
436
|
+
icon: L.icon(this.configurationMap.iconMarker || this.markerIcon),
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Por defecto, usar circleMarker básico
|
|
441
|
+
return L.circleMarker(latlng, {
|
|
442
|
+
color: "green",
|
|
443
|
+
fillColor: "green",
|
|
444
|
+
fillOpacity: 0.8,
|
|
445
|
+
radius: 6,
|
|
446
|
+
weight: 2,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Para otros tipos de geometría, dejar que Leaflet use el valor por defecto
|
|
451
|
+
return L.marker(latlng);
|
|
452
|
+
},
|
|
339
453
|
async searchAddress(query: string) {
|
|
340
454
|
const address = await axios.get(
|
|
341
455
|
location.protocol + "//nominatim.openstreetmap.org/search?",
|