vue-geojson-view-ts 1.3.13 → 1.3.15
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/MapSearchAddress.vue.d.ts +252 -0
- package/dist/style.css +1 -1
- package/dist/vue-geojson-view-ts.js +13509 -12064
- package/dist/vue-geojson-view-ts.umd.cjs +65 -49
- package/package.json +3 -2
- package/src/components/CoordinatesVerifyPolygon.vue +48 -29
- package/src/components/MapHeatComponent.vue +4 -1
- package/src/components/MapSearchAddress.vue +117 -8
- package/src/components/MapView.vue +145 -9
- package/dist/components/MapView.vue.d.ts +0 -56
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-geojson-view-ts",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -73,5 +73,6 @@
|
|
|
73
73
|
"screenfull": "^6.0.2",
|
|
74
74
|
"typewriter-effect": "^2.19.0",
|
|
75
75
|
"vue-router": "^4.2.5"
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
"packageManager": "yarn@4.5.3+sha512.3003a14012e2987072d244c720506549c1aab73ee728208f1b2580a9fd67b92d61ba6b08fe93f6dce68fd771e3af1e59a0afa28dd242dd0940d73b95fedd4e90"
|
|
77
78
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div ref="maps" id="maps"></div>
|
|
3
3
|
</template>
|
|
4
|
-
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { markerDefault } from '../helpers/imgBase64'
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import 'leaflet/dist/leaflet.css';
|
|
11
|
-
import * as turf from '@turf/turf';
|
|
12
|
-
import { IconOptions } from 'leaflet';
|
|
13
|
-
import 'leaflet.fullscreen/Control.FullScreen.css'
|
|
14
|
-
import 'leaflet.fullscreen'
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import { markerDefault } from "../helpers/imgBase64";
|
|
15
7
|
|
|
8
|
+
import { defineComponent } from "vue";
|
|
9
|
+
import * as L from "leaflet";
|
|
10
|
+
import "leaflet/dist/leaflet.css";
|
|
11
|
+
import * as turf from "@turf/turf";
|
|
12
|
+
import { IconOptions } from "leaflet";
|
|
13
|
+
import "leaflet.fullscreen/Control.FullScreen.css";
|
|
14
|
+
import "leaflet.fullscreen";
|
|
16
15
|
|
|
17
16
|
export default defineComponent({
|
|
18
17
|
name: "CoordinatesVerifyPolygon",
|
|
@@ -20,7 +19,7 @@ export default defineComponent({
|
|
|
20
19
|
dataPolygon: Object,
|
|
21
20
|
iconMarker: Object,
|
|
22
21
|
coordinatesMap: Array,
|
|
23
|
-
checkPointInPolygon: Function
|
|
22
|
+
checkPointInPolygon: Function,
|
|
24
23
|
},
|
|
25
24
|
data() {
|
|
26
25
|
return {
|
|
@@ -28,40 +27,60 @@ export default defineComponent({
|
|
|
28
27
|
iconUrl: markerDefault,
|
|
29
28
|
iconSize: [25, 41],
|
|
30
29
|
iconAnchor: [12, 41],
|
|
31
|
-
}
|
|
32
|
-
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
33
32
|
},
|
|
34
33
|
mounted() {
|
|
35
34
|
this.verificarPuntoEnPoligono();
|
|
36
35
|
},
|
|
37
36
|
methods: {
|
|
38
37
|
verificarPuntoEnPoligono() {
|
|
39
|
-
const iconDefaultMarket = this.iconMarker
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const iconDefaultMarket = this.iconMarker
|
|
39
|
+
? this.iconMarker
|
|
40
|
+
: this.markerIconDefault;
|
|
41
|
+
const data = this.dataPolygon?.geometry.coordinates[0].map(
|
|
42
|
+
(e: number[]) => [e[1], e[0]]
|
|
43
|
+
);
|
|
44
|
+
const polygonCoordinates: L.LatLngExpression[] = JSON.parse(
|
|
45
|
+
JSON.stringify(data)
|
|
46
|
+
);
|
|
47
|
+
const pointCoordinates = [
|
|
48
|
+
this.coordinatesMap ? (this.coordinatesMap[0] as number) : 0,
|
|
49
|
+
this.coordinatesMap ? (this.coordinatesMap[1] as number) : 0,
|
|
50
|
+
];
|
|
51
|
+
const map = L.map("maps", { fullscreenControl: true } as any).setView(
|
|
52
|
+
[
|
|
53
|
+
this.coordinatesMap ? (this.coordinatesMap[0] as number) : 0,
|
|
54
|
+
this.coordinatesMap ? (this.coordinatesMap[1] as number) : 0,
|
|
55
|
+
],
|
|
56
|
+
this.coordinatesMap ? (this.coordinatesMap[2] as number) : 0
|
|
57
|
+
);
|
|
58
|
+
L.tileLayer("https://tile.openstreetmaps.org/{z}/{x}/{y}.png", {
|
|
45
59
|
maxZoom: 19,
|
|
46
|
-
attribution:
|
|
47
|
-
|
|
60
|
+
attribution:
|
|
61
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
62
|
+
}).addTo(map);
|
|
48
63
|
L.polygon(polygonCoordinates).addTo(map);
|
|
49
|
-
const markerCoordinates: L.LatLngExpression = [
|
|
64
|
+
const markerCoordinates: L.LatLngExpression = [
|
|
65
|
+
this.coordinatesMap ? (this.coordinatesMap[0] as number) : 0,
|
|
66
|
+
this.coordinatesMap ? (this.coordinatesMap[1] as number) : 0,
|
|
67
|
+
];
|
|
50
68
|
const markerIcon = L.icon(iconDefaultMarket as IconOptions);
|
|
51
69
|
L.marker(markerCoordinates, { icon: markerIcon }).addTo(map);
|
|
52
70
|
const pointGeoJSON = turf.point(pointCoordinates);
|
|
53
71
|
const polygonGeoJSON = turf.polygon([data]);
|
|
54
|
-
const isPointInside = turf.booleanPointInPolygon(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
const isPointInside = turf.booleanPointInPolygon(
|
|
73
|
+
pointGeoJSON,
|
|
74
|
+
polygonGeoJSON
|
|
75
|
+
);
|
|
76
|
+
if (this.checkPointInPolygon) this.checkPointInPolygon(isPointInside);
|
|
77
|
+
},
|
|
78
|
+
},
|
|
59
79
|
});
|
|
60
80
|
</script>
|
|
61
|
-
|
|
81
|
+
|
|
62
82
|
<style>
|
|
63
83
|
#maps {
|
|
64
84
|
height: 500px;
|
|
65
85
|
}
|
|
66
86
|
</style>
|
|
67
|
-
|
|
@@ -233,7 +233,10 @@ export default defineComponent({
|
|
|
233
233
|
format: new GeoJSON(),
|
|
234
234
|
}),
|
|
235
235
|
style: function (feature) {
|
|
236
|
-
style.getText()
|
|
236
|
+
const textStyle = style.getText();
|
|
237
|
+
if (textStyle) {
|
|
238
|
+
textStyle.setText(feature.get("name"));
|
|
239
|
+
}
|
|
237
240
|
return style;
|
|
238
241
|
},
|
|
239
242
|
});
|
|
@@ -9,9 +9,11 @@ import * as L from "leaflet";
|
|
|
9
9
|
import "leaflet/dist/leaflet.css";
|
|
10
10
|
import { onMounted, ref } from "vue";
|
|
11
11
|
import { markerDefault } from "../helpers/imgBase64";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import "leaflet.fullscreen/Control.FullScreen.css";
|
|
13
|
+
import "leaflet.fullscreen";
|
|
14
14
|
import axios from "axios";
|
|
15
|
+
import gpsIcon from "../assets/gps.svg";
|
|
16
|
+
import sateliteIcon from "../assets/satelite.svg";
|
|
15
17
|
|
|
16
18
|
export type TIconMaker = {
|
|
17
19
|
iconUrl: string;
|
|
@@ -37,6 +39,7 @@ export interface ICoords {
|
|
|
37
39
|
export interface IMapSearchAddressProps {
|
|
38
40
|
configurationMap?: IConfigurationMap;
|
|
39
41
|
coordinatesMap?: ICoords;
|
|
42
|
+
isSatelite?: boolean;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
const props = withDefaults(defineProps<IMapSearchAddressProps>(), {
|
|
@@ -69,6 +72,8 @@ const idMap = ref();
|
|
|
69
72
|
const coords = ref(props.coordinatesMap);
|
|
70
73
|
const mapRender = ref();
|
|
71
74
|
const markerRender = ref();
|
|
75
|
+
const currentTileLayer = ref<L.TileLayer | null>(null);
|
|
76
|
+
const isSatelliteView = ref(false);
|
|
72
77
|
|
|
73
78
|
onMounted(async () => {
|
|
74
79
|
await makeid(10);
|
|
@@ -93,17 +98,40 @@ const renderMap = async () => {
|
|
|
93
98
|
|
|
94
99
|
const createMap = async () => {
|
|
95
100
|
const iconMarker = props.configurationMap?.iconMarker;
|
|
96
|
-
const map = L.map(idMap.value,{fullscreenControl:true} as any).setView(
|
|
101
|
+
const map = L.map(idMap.value, { fullscreenControl: true } as any).setView(
|
|
97
102
|
[coords.value.lat, coords.value.lng],
|
|
98
103
|
coords.value.zoom
|
|
99
104
|
);
|
|
100
105
|
map.invalidateSize();
|
|
101
106
|
mapRender.value = map;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
|
|
108
|
+
// Inicializar con la vista correcta según el prop
|
|
109
|
+
isSatelliteView.value = props.isSatelite || false;
|
|
110
|
+
if (isSatelliteView.value) {
|
|
111
|
+
currentTileLayer.value = L.tileLayer(
|
|
112
|
+
"https://api.maptiler.com/maps/satellite/{z}/{x}/{y}.jpg?key=t8mWT2ozs1JWBqMZOnZr",
|
|
113
|
+
{
|
|
114
|
+
attribution:
|
|
115
|
+
'© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
} else {
|
|
119
|
+
currentTileLayer.value = L.tileLayer(
|
|
120
|
+
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
121
|
+
{
|
|
122
|
+
maxZoom: props.configurationMap?.maxZoom,
|
|
123
|
+
attribution:
|
|
124
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
currentTileLayer.value.addTo(map);
|
|
129
|
+
|
|
130
|
+
// Agregar el control satelital si está habilitado
|
|
131
|
+
if (props.isSatelite !== undefined) {
|
|
132
|
+
const satelliteControl = createSatelliteControl();
|
|
133
|
+
map.addControl(satelliteControl);
|
|
134
|
+
}
|
|
107
135
|
|
|
108
136
|
if (iconMarker.type === "image") {
|
|
109
137
|
const marker = L.marker([coords.value.lat, coords.value.lng], {
|
|
@@ -148,6 +176,87 @@ const createMap = async () => {
|
|
|
148
176
|
}
|
|
149
177
|
};
|
|
150
178
|
|
|
179
|
+
const createSatelliteControl = (): L.Control => {
|
|
180
|
+
const SatelliteControl = L.Control.extend({
|
|
181
|
+
onAdd: (map: L.Map) => {
|
|
182
|
+
const container = L.DomUtil.create(
|
|
183
|
+
"div",
|
|
184
|
+
"leaflet-control-draw leaflet-bar leaflet-control"
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const satelliteButton = L.DomUtil.create(
|
|
188
|
+
"a",
|
|
189
|
+
"leaflet-draw-draw-satellite",
|
|
190
|
+
container
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
satelliteButton.href = "#";
|
|
194
|
+
satelliteButton.title = isSatelliteView.value
|
|
195
|
+
? "Vista Normal"
|
|
196
|
+
: "Vista Satélite";
|
|
197
|
+
|
|
198
|
+
// Usar el mismo estilo que los otros botones de draw
|
|
199
|
+
satelliteButton.style.backgroundImage = isSatelliteView.value
|
|
200
|
+
? `url(${gpsIcon})`
|
|
201
|
+
: `url(${sateliteIcon})`;
|
|
202
|
+
satelliteButton.style.backgroundPosition = "center";
|
|
203
|
+
satelliteButton.style.backgroundRepeat = "no-repeat";
|
|
204
|
+
satelliteButton.style.backgroundSize = "20px 20px";
|
|
205
|
+
|
|
206
|
+
L.DomEvent.disableClickPropagation(satelliteButton);
|
|
207
|
+
L.DomEvent.on(satelliteButton, "click", toggleSatelliteView);
|
|
208
|
+
|
|
209
|
+
return container;
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
return new SatelliteControl({ position: "topleft" });
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const toggleSatelliteView = (): void => {
|
|
217
|
+
if (!mapRender.value || !currentTileLayer.value) return;
|
|
218
|
+
|
|
219
|
+
isSatelliteView.value = !isSatelliteView.value;
|
|
220
|
+
|
|
221
|
+
// Remover la capa actual
|
|
222
|
+
mapRender.value.removeLayer(currentTileLayer.value as unknown as L.Layer);
|
|
223
|
+
|
|
224
|
+
// Agregar la nueva capa
|
|
225
|
+
if (isSatelliteView.value) {
|
|
226
|
+
currentTileLayer.value = L.tileLayer(
|
|
227
|
+
"https://api.maptiler.com/maps/satellite/{z}/{x}/{y}.jpg?key=t8mWT2ozs1JWBqMZOnZr",
|
|
228
|
+
{
|
|
229
|
+
attribution:
|
|
230
|
+
'© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
} else {
|
|
234
|
+
currentTileLayer.value = L.tileLayer(
|
|
235
|
+
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
236
|
+
{
|
|
237
|
+
attribution:
|
|
238
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
currentTileLayer.value.addTo(mapRender.value as L.Map);
|
|
244
|
+
|
|
245
|
+
// Actualizar el ícono del control satelital
|
|
246
|
+
const satelliteButtons = document.querySelectorAll(
|
|
247
|
+
".leaflet-draw-draw-satellite"
|
|
248
|
+
);
|
|
249
|
+
satelliteButtons.forEach((button) => {
|
|
250
|
+
const htmlButton = button as HTMLElement;
|
|
251
|
+
htmlButton.style.backgroundImage = isSatelliteView.value
|
|
252
|
+
? `url(${gpsIcon})`
|
|
253
|
+
: `url(${sateliteIcon})`;
|
|
254
|
+
htmlButton.title = isSatelliteView.value
|
|
255
|
+
? "Vista Normal"
|
|
256
|
+
: "Vista Satélite";
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
|
|
151
260
|
const searchAddress = async (query: string) => {
|
|
152
261
|
const address = await axios.get(
|
|
153
262
|
location.protocol + "//nominatim.openstreetmap.org/search?",
|
|
@@ -18,6 +18,8 @@ import drawLocales from "leaflet-draw-locales";
|
|
|
18
18
|
import axios from "axios";
|
|
19
19
|
import "leaflet.fullscreen/Control.FullScreen.css";
|
|
20
20
|
import "leaflet.fullscreen";
|
|
21
|
+
import gpsIcon from "../assets/gps.svg";
|
|
22
|
+
import sateliteIcon from "../assets/satelite.svg";
|
|
21
23
|
|
|
22
24
|
declare global {
|
|
23
25
|
interface Window {
|
|
@@ -69,6 +71,7 @@ export default defineComponent({
|
|
|
69
71
|
coordinatesMap: Array,
|
|
70
72
|
getGeoJSON: Function,
|
|
71
73
|
getCoodMarker: Function,
|
|
74
|
+
isSatelite: Boolean,
|
|
72
75
|
},
|
|
73
76
|
data() {
|
|
74
77
|
return {
|
|
@@ -84,6 +87,8 @@ export default defineComponent({
|
|
|
84
87
|
},
|
|
85
88
|
layersFeatureGroup: null as any,
|
|
86
89
|
featuresData: null as any,
|
|
90
|
+
currentTileLayer: null as L.TileLayer | null,
|
|
91
|
+
isSatelliteView: false,
|
|
87
92
|
};
|
|
88
93
|
},
|
|
89
94
|
mounted() {
|
|
@@ -91,6 +96,90 @@ export default defineComponent({
|
|
|
91
96
|
this.renderMap();
|
|
92
97
|
},
|
|
93
98
|
methods: {
|
|
99
|
+
createSatelliteControl(): L.Control {
|
|
100
|
+
const SatelliteControl = L.Control.extend({
|
|
101
|
+
onAdd: (map: L.Map) => {
|
|
102
|
+
const container = L.DomUtil.create(
|
|
103
|
+
"div",
|
|
104
|
+
"leaflet-control-draw leaflet-bar leaflet-control"
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const satelliteButton = L.DomUtil.create(
|
|
108
|
+
"a",
|
|
109
|
+
"leaflet-draw-draw-satellite",
|
|
110
|
+
container
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
satelliteButton.href = "#";
|
|
114
|
+
satelliteButton.title = this.isSatelliteView
|
|
115
|
+
? "Vista Normal"
|
|
116
|
+
: "Vista Satélite";
|
|
117
|
+
|
|
118
|
+
// Usar el mismo estilo que los otros botones de draw
|
|
119
|
+
satelliteButton.style.backgroundImage = this.isSatelliteView
|
|
120
|
+
? `url(${gpsIcon})`
|
|
121
|
+
: `url(${sateliteIcon})`;
|
|
122
|
+
satelliteButton.style.backgroundPosition = "center";
|
|
123
|
+
satelliteButton.style.backgroundRepeat = "no-repeat";
|
|
124
|
+
satelliteButton.style.backgroundSize = "20px 20px";
|
|
125
|
+
|
|
126
|
+
L.DomEvent.disableClickPropagation(satelliteButton);
|
|
127
|
+
L.DomEvent.on(
|
|
128
|
+
satelliteButton,
|
|
129
|
+
"click",
|
|
130
|
+
this.toggleSatelliteView,
|
|
131
|
+
this
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
return container;
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return new SatelliteControl({ position: "topleft" });
|
|
139
|
+
},
|
|
140
|
+
toggleSatelliteView(): void {
|
|
141
|
+
if (!this.mapRender || !this.currentTileLayer) return;
|
|
142
|
+
|
|
143
|
+
this.isSatelliteView = !this.isSatelliteView;
|
|
144
|
+
|
|
145
|
+
// Remover la capa actual
|
|
146
|
+
this.mapRender.removeLayer(this.currentTileLayer as unknown as L.Layer);
|
|
147
|
+
|
|
148
|
+
// Agregar la nueva capa
|
|
149
|
+
if (this.isSatelliteView) {
|
|
150
|
+
this.currentTileLayer = L.tileLayer(
|
|
151
|
+
"https://api.maptiler.com/maps/satellite/{z}/{x}/{y}.jpg?key=t8mWT2ozs1JWBqMZOnZr",
|
|
152
|
+
{
|
|
153
|
+
attribution:
|
|
154
|
+
'© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
} else {
|
|
158
|
+
this.currentTileLayer = L.tileLayer(
|
|
159
|
+
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
160
|
+
{
|
|
161
|
+
attribution:
|
|
162
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
this.currentTileLayer.addTo(this.mapRender as L.Map);
|
|
168
|
+
|
|
169
|
+
// Actualizar el ícono del control satelital
|
|
170
|
+
const satelliteButtons = document.querySelectorAll(
|
|
171
|
+
".leaflet-draw-draw-satellite"
|
|
172
|
+
);
|
|
173
|
+
satelliteButtons.forEach((button) => {
|
|
174
|
+
const htmlButton = button as HTMLElement;
|
|
175
|
+
htmlButton.style.backgroundImage = this.isSatelliteView
|
|
176
|
+
? `url(${gpsIcon})`
|
|
177
|
+
: `url(${sateliteIcon})`;
|
|
178
|
+
htmlButton.title = this.isSatelliteView
|
|
179
|
+
? "Vista Normal"
|
|
180
|
+
: "Vista Satélite";
|
|
181
|
+
});
|
|
182
|
+
},
|
|
94
183
|
getLayersFeaturesInGeoJson() {
|
|
95
184
|
const geojson = L.geoJSON().addTo(this.mapRender as any);
|
|
96
185
|
this.featuresData.eachLayer((layer: any) => {
|
|
@@ -147,11 +236,34 @@ export default defineComponent({
|
|
|
147
236
|
this.renderCoordinates ? (this.renderCoordinates[2] as number) : 0
|
|
148
237
|
);
|
|
149
238
|
this.mapRender = map;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
239
|
+
|
|
240
|
+
// Inicializar con la vista correcta según el prop
|
|
241
|
+
this.isSatelliteView = this.isSatelite || false;
|
|
242
|
+
if (this.isSatelliteView) {
|
|
243
|
+
this.currentTileLayer = L.tileLayer(
|
|
244
|
+
"https://api.maptiler.com/maps/satellite/{z}/{x}/{y}.jpg?key=t8mWT2ozs1JWBqMZOnZr",
|
|
245
|
+
{
|
|
246
|
+
attribution:
|
|
247
|
+
'© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
} else {
|
|
251
|
+
this.currentTileLayer = L.tileLayer(
|
|
252
|
+
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
253
|
+
{
|
|
254
|
+
attribution:
|
|
255
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
this.currentTileLayer.addTo(map);
|
|
260
|
+
|
|
261
|
+
// Agregar el control satelital si está habilitado
|
|
262
|
+
if (this.isSatelite !== undefined) {
|
|
263
|
+
const satelliteControl = this.createSatelliteControl();
|
|
264
|
+
map.addControl(satelliteControl);
|
|
265
|
+
}
|
|
266
|
+
|
|
155
267
|
map.setZoom(this.configurationMap?.maxZoom);
|
|
156
268
|
if (this.configurationMap.renderMarker) {
|
|
157
269
|
const marker = L.marker(
|
|
@@ -279,10 +391,34 @@ export default defineComponent({
|
|
|
279
391
|
this.renderCoordinates ? (this.renderCoordinates[2] as number) : 0
|
|
280
392
|
);
|
|
281
393
|
this.mapRender = map;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
394
|
+
|
|
395
|
+
// Inicializar con la vista correcta según el prop
|
|
396
|
+
this.isSatelliteView = this.isSatelite || false;
|
|
397
|
+
if (this.isSatelliteView) {
|
|
398
|
+
this.currentTileLayer = L.tileLayer(
|
|
399
|
+
"https://api.maptiler.com/maps/satellite/{z}/{x}/{y}.jpg?key=t8mWT2ozs1JWBqMZOnZr",
|
|
400
|
+
{
|
|
401
|
+
attribution:
|
|
402
|
+
'© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
} else {
|
|
406
|
+
this.currentTileLayer = L.tileLayer(
|
|
407
|
+
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
408
|
+
{
|
|
409
|
+
attribution:
|
|
410
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
this.currentTileLayer.addTo(map);
|
|
415
|
+
|
|
416
|
+
// Agregar el control satelital si está habilitado
|
|
417
|
+
if (this.isSatelite !== undefined) {
|
|
418
|
+
const satelliteControl = this.createSatelliteControl();
|
|
419
|
+
map.addControl(satelliteControl);
|
|
420
|
+
}
|
|
421
|
+
|
|
286
422
|
map.setZoom(this.configurationMap?.maxZoom);
|
|
287
423
|
const featuresData = L.featureGroup();
|
|
288
424
|
this.featuresData = featuresData;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import * as L from "leaflet";
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
type: boolean;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
declare const _sfc_main: import("vue").DefineComponent<{
|
|
8
|
-
loadPolygon: BooleanConstructor;
|
|
9
|
-
reverseCoordinatesPolygon: BooleanConstructor;
|
|
10
|
-
dataPolygon: ObjectConstructor;
|
|
11
|
-
configurationMap: any;
|
|
12
|
-
coordinatesMap: ArrayConstructor;
|
|
13
|
-
getGeoJSON: FunctionConstructor;
|
|
14
|
-
getCoodMarker: FunctionConstructor;
|
|
15
|
-
}, unknown, {
|
|
16
|
-
idMap: string;
|
|
17
|
-
mapRender: L.Map | null;
|
|
18
|
-
markerRender: L.Marker<any> | null;
|
|
19
|
-
renderCoordinates: unknown[] | undefined;
|
|
20
|
-
renderGeojson: any;
|
|
21
|
-
markerIcon: {
|
|
22
|
-
iconUrl: string;
|
|
23
|
-
iconSize: number[];
|
|
24
|
-
iconAnchor: number[];
|
|
25
|
-
};
|
|
26
|
-
layersFeatureGroup: any;
|
|
27
|
-
featuresData: any;
|
|
28
|
-
}, {}, {
|
|
29
|
-
getLayersFeaturesInGeoJson(): (import("geojson").GeometryCollection<import("geojson").Geometry> | import("geojson").FeatureCollection<import("geojson").Geometry, any> | import("geojson").Feature<import("geojson").MultiPoint, any>)[];
|
|
30
|
-
triggerSaveEdit(): void;
|
|
31
|
-
makeid(length: number): void;
|
|
32
|
-
renderMap(): void;
|
|
33
|
-
createMap(): void;
|
|
34
|
-
viewMap(): void;
|
|
35
|
-
getPointToLayer(feature: any, latlng: any): L.Marker<any>;
|
|
36
|
-
searchAddress(query: string): Promise<any>;
|
|
37
|
-
setCoordinates({ lat, lng, }: {
|
|
38
|
-
lat: number;
|
|
39
|
-
lng: number;
|
|
40
|
-
moveMarker?: boolean | undefined;
|
|
41
|
-
}): void;
|
|
42
|
-
getPopupContent(feature: any): string;
|
|
43
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
|
-
loadPolygon: BooleanConstructor;
|
|
45
|
-
reverseCoordinatesPolygon: BooleanConstructor;
|
|
46
|
-
dataPolygon: ObjectConstructor;
|
|
47
|
-
configurationMap: any;
|
|
48
|
-
coordinatesMap: ArrayConstructor;
|
|
49
|
-
getGeoJSON: FunctionConstructor;
|
|
50
|
-
getCoodMarker: FunctionConstructor;
|
|
51
|
-
}>>, {
|
|
52
|
-
loadPolygon: boolean;
|
|
53
|
-
reverseCoordinatesPolygon: boolean;
|
|
54
|
-
configurationMap: any;
|
|
55
|
-
}, {}>;
|
|
56
|
-
export default _sfc_main;
|