vue-geojson-view-ts 1.3.17 → 1.3.18
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/README.md +321 -321
- package/dist/components/MapSearchAddress.vue.d.ts +1 -1
- package/dist/data/bolivia.geojson +2084 -2084
- package/dist/data/cities/be.geojson +246 -246
- package/dist/data/cities/cbba.geojson +165 -165
- package/dist/data/cities/ch.geojson +170 -170
- package/dist/data/cities/lp.geojson +314 -314
- package/dist/data/cities/or.geojson +253 -253
- package/dist/data/cities/pd.geojson +164 -164
- package/dist/data/cities/pt.geojson +379 -379
- package/dist/data/cities/sc.geojson +224 -224
- package/dist/data/cities/tj.geojson +86 -86
- package/dist/pin.svg +4 -4
- package/dist/style.css +1 -1
- package/dist/vite-env.d.ts +1 -1
- package/dist/vue-geojson-view-ts.js +11434 -10075
- package/dist/vue-geojson-view-ts.umd.cjs +65 -49
- package/package.json +78 -78
- package/src/components/CoordinatesVerifyPolygon.vue +86 -86
- package/src/components/MapHeatComponent.vue +664 -664
- package/src/components/MapSearchAddress.vue +309 -309
- package/src/components/MapView.vue +718 -716
package/README.md
CHANGED
|
@@ -1,322 +1,322 @@
|
|
|
1
|
-
|
|
2
|
-
## Descripcion
|
|
3
|
-
|
|
4
|
-
Paquete para el uso de mapas con openstreetmap y geojson con VITE & VUE
|
|
5
|
-
|
|
6
|
-
## Instalacion
|
|
7
|
-
|
|
8
|
-
Instalacion del paquete
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
npm i vue-geojson-view-ts
|
|
12
|
-
```
|
|
13
|
-
## Configuracion Creacion de Polygonos
|
|
14
|
-
Configuracion para la creacion de polygonos dentro del mapa
|
|
15
|
-
```typescript
|
|
16
|
-
<template>
|
|
17
|
-
<div>
|
|
18
|
-
<MapView :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON" :getCoodMarker="getCoodMarker"></MapView>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
import { MapView } from 'vue-geojson-view-ts'
|
|
24
|
-
import { ref } from 'vue';
|
|
25
|
-
|
|
26
|
-
const iconMarker = {
|
|
27
|
-
iconUrl:'/images/icon.png'.
|
|
28
|
-
iconSize: [25, 41],
|
|
29
|
-
iconAnchor: [12, 41],
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const configurationMap = {
|
|
33
|
-
height:'500px',
|
|
34
|
-
iconMarker:{
|
|
35
|
-
iconUrl:'https://cdn.onlinewebfonts.com/svg/img_466240.png',
|
|
36
|
-
iconSize: [25, 41],
|
|
37
|
-
iconAnchor: [12, 41],
|
|
38
|
-
},
|
|
39
|
-
maxZoom:19,
|
|
40
|
-
renderMarker:true,
|
|
41
|
-
dragMarker:true,
|
|
42
|
-
createFigures:{
|
|
43
|
-
polygon: true,
|
|
44
|
-
circle: true,
|
|
45
|
-
rectangle: true,
|
|
46
|
-
marker:true,
|
|
47
|
-
},
|
|
48
|
-
editFigures:{
|
|
49
|
-
edit: true,
|
|
50
|
-
remove: true
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
54
|
-
|
|
55
|
-
const getGeoJSON = (geojson:any) =>{
|
|
56
|
-
console.log(geojson)
|
|
57
|
-
}
|
|
58
|
-
const getCoodMarker = (lat:number,long:number) =>{
|
|
59
|
-
console.log(lat,long)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<style>
|
|
66
|
-
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
67
|
-
</style>
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Configuracion de vista o edicion de Polygonos
|
|
72
|
-
Configuracion para la edicion o solo vista de polygonos dentro del mapa
|
|
73
|
-
```typescript
|
|
74
|
-
<template>
|
|
75
|
-
<div>
|
|
76
|
-
<MapView :loadPolygon="true" :dataPolygon="dataPolygon" :reverseCoordinatesPolygon="true" :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON"></MapView>
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
|
-
<script setup lang="ts">
|
|
81
|
-
import { MapView } from 'vue-geojson-view-ts'
|
|
82
|
-
import { ref } from 'vue';
|
|
83
|
-
|
|
84
|
-
const iconMarker = {
|
|
85
|
-
iconUrl:'/images/icon.png'.
|
|
86
|
-
iconSize: [25, 41],
|
|
87
|
-
iconAnchor: [12, 41],
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const configurationMap = {
|
|
91
|
-
height:'500px',
|
|
92
|
-
iconMarker:{
|
|
93
|
-
iconUrl:'https://cdn.onlinewebfonts.com/svg/img_466240.png',
|
|
94
|
-
iconSize: [25, 41],
|
|
95
|
-
iconAnchor: [12, 41],
|
|
96
|
-
},
|
|
97
|
-
maxZoom:19,
|
|
98
|
-
renderMarker:true,
|
|
99
|
-
dragMarker:false,
|
|
100
|
-
createFigures:{
|
|
101
|
-
polygon: false,
|
|
102
|
-
rectangle: false,
|
|
103
|
-
marker:false,
|
|
104
|
-
},
|
|
105
|
-
editFigures:{
|
|
106
|
-
edit: false,
|
|
107
|
-
remove: false
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
112
|
-
|
|
113
|
-
const getGeoJSON = (geojson:any) =>{
|
|
114
|
-
console.log(geojson)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const dataPolygon =[{"type":"Feature","properties":{},
|
|
118
|
-
"geometry":{"type":"Polygon","coordinates":[
|
|
119
|
-
[[-65.268488,-19.038266],[-65.25703,-19.034128],[-65.256085,-19.039361],[-65.268788,-19.043337],[-65.268488,-19.038266]]
|
|
120
|
-
]}}] //
|
|
121
|
-
|
|
122
|
-
</script>
|
|
123
|
-
|
|
124
|
-
<style>
|
|
125
|
-
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
126
|
-
</style>
|
|
127
|
-
```
|
|
128
|
-
## Configuracion de Trigger click button Save Edit (Guardar Edicion de Polygonos)
|
|
129
|
-
Configuracion para ejecutar el disparador que guarda el polygono desde un boton fuera del mapa
|
|
130
|
-
```typescript
|
|
131
|
-
<template>
|
|
132
|
-
<div>
|
|
133
|
-
<button @click="SaveEdit">Trigger Save Edit</button>
|
|
134
|
-
<div style="display:flex;width: 100%;">
|
|
135
|
-
<div style="width:30%">
|
|
136
|
-
<MapView :loadPolygon="true" ref="Ref_MapView" :dataPolygon="dataPolygon" :reverseCoordinatesPolygon="true" :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON"></MapView>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
</template>
|
|
140
|
-
|
|
141
|
-
<script setup lang="ts">
|
|
142
|
-
import {MapView} from "vue-geojson-view-ts"
|
|
143
|
-
import { ref } from "vue";
|
|
144
|
-
const Ref_MapView = ref();
|
|
145
|
-
const configurationMap = {
|
|
146
|
-
height:'500px',
|
|
147
|
-
iconMarker:{
|
|
148
|
-
iconUrl:'https://cdn.onlinewebfonts.com/svg/img_466240.png',
|
|
149
|
-
iconSize: [25, 41],
|
|
150
|
-
iconAnchor: [12, 41],
|
|
151
|
-
},
|
|
152
|
-
maxZoom:19,
|
|
153
|
-
renderMarker:true,
|
|
154
|
-
dragMarker:false,
|
|
155
|
-
createFigures:{
|
|
156
|
-
polygon: false,
|
|
157
|
-
rectangle: false,
|
|
158
|
-
marker:false,
|
|
159
|
-
},
|
|
160
|
-
editFigures:{
|
|
161
|
-
edit: true,
|
|
162
|
-
remove: true
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const coordinatesMap = [-19.0382054,-65.2662444,13]
|
|
166
|
-
|
|
167
|
-
const getGeoJSON = (geojson:any) =>{
|
|
168
|
-
////Los datos seran enviados a este callback desde el boton dentro del mapa como desde el TRIGGER
|
|
169
|
-
console.log("geojson",geojson)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const SaveEdit = () =>{
|
|
173
|
-
Ref_MapView.value.triggerSaveEdit()
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const getLayersFeatures = () =>{
|
|
177
|
-
const getLayersToGeoJson = Ref_MapView.value.getLayersFeaturesInGeoJson()
|
|
178
|
-
console.log(getLayersToGeoJson)
|
|
179
|
-
}
|
|
180
|
-
</script>
|
|
181
|
-
```
|
|
182
|
-
## Configuracion de Marcador o Puntero dentro de polygono
|
|
183
|
-
Configuracion para ver si un punto esta dentro de un polygono
|
|
184
|
-
```typescript
|
|
185
|
-
<template>
|
|
186
|
-
<div>
|
|
187
|
-
<CoordinatesVerifyPolygon :dataPolygon="dataPolygon" :coordinatesMap="coordinatesMap" :iconMarker="iconMarker" :checkPointInPolygon = "checkPointInPolygon"/>
|
|
188
|
-
</div>
|
|
189
|
-
</template>
|
|
190
|
-
|
|
191
|
-
<script setup lang="ts">
|
|
192
|
-
|
|
193
|
-
const iconMarker = {
|
|
194
|
-
iconUrl:'/images/icon.png'.
|
|
195
|
-
iconSize: [25, 41],
|
|
196
|
-
iconAnchor: [12, 41],
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
200
|
-
|
|
201
|
-
const checkPointInPolygon = (check:Boolean) =>{
|
|
202
|
-
console.log(check)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const dataPolygon = {"type":"Feature","properties":{},
|
|
206
|
-
"geometry":{"type":"Polygon","coordinates":[
|
|
207
|
-
[[-65.268488,-19.038266],[-65.25703,-19.034128],[-65.256085,-19.039361],[-65.268788,-19.043337],[-65.268488,-19.038266]]
|
|
208
|
-
]}}
|
|
209
|
-
|
|
210
|
-
</script>
|
|
211
|
-
|
|
212
|
-
<style>
|
|
213
|
-
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
214
|
-
</style>
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
## Utilizar Google Maps para la busqueda de direcciones
|
|
219
|
-
Configuracion para el uso del buscador de direcciones de googlemaps
|
|
220
|
-
#### IMP.- Por seguridad y uso solo de los sitios esperados... se debe enviar un parametro blts=listen por la url ej: http://localhost:8080/?blts=listen donde se quira utilizar la extension
|
|
221
|
-
|
|
222
|
-
#### 1.- Instalar la extension
|
|
223
|
-
##### a.- Dirijase a brave://extensions/ o chrome://extensions/
|
|
224
|
-
##### b.- Habilite la opcion desarrollador
|
|
225
|
-
##### c.- Luego clic en CARGAR DESCOMPRIMIDO
|
|
226
|
-
##### d.- Busque la extension descargada y descomprimido "GMI" de este repositorio
|
|
227
|
-
|
|
228
|
-
#### 2.- En su componente principal App.vue cargue listenServiceGoogleMaps este servicio escuchara cuando se abra y encuentre las coordenadas de su busqueda en google.
|
|
229
|
-
|
|
230
|
-
```typescript
|
|
231
|
-
import {listenServiceGoogleMaps} from 'vue-geojson-view-ts'
|
|
232
|
-
import { onMounted } from 'vue';
|
|
233
|
-
|
|
234
|
-
onMounted(() => {
|
|
235
|
-
listenServiceGoogleMaps()
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
#### 3.- Donde tenga cargado su Mapa importe su tipo de buscador que desea utilizar
|
|
241
|
-
|
|
242
|
-
```typescript
|
|
243
|
-
<template>
|
|
244
|
-
<div>
|
|
245
|
-
<MapView :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON" :getCoodMarker="getCoodMarker"></MapView>
|
|
246
|
-
</div>
|
|
247
|
-
<button @click="manualGoogleMaps">manual</button>
|
|
248
|
-
<button @click="automaticGoogleMaps">automatic</button>
|
|
249
|
-
</template>
|
|
250
|
-
|
|
251
|
-
<script setup lang="ts">
|
|
252
|
-
import {searchAutomaticGoogleMaps,searchManualGoogleMaps} from 'vue-geojson-view'
|
|
253
|
-
import { ref } from 'vue';
|
|
254
|
-
|
|
255
|
-
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
256
|
-
|
|
257
|
-
const manualGoogleMaps = () =>{
|
|
258
|
-
searchManualGoogleMaps().then(cood =>{
|
|
259
|
-
coordinatesMap.value = cood
|
|
260
|
-
}).catch(e=>{
|
|
261
|
-
throw e
|
|
262
|
-
})
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const automaticGoogleMaps = () =>{
|
|
266
|
-
searchAutomaticGoogleMaps('Santa Cruz, Bolivia').then(cood=>{
|
|
267
|
-
coordinatesMap.value = cood
|
|
268
|
-
}).catch(e=>{
|
|
269
|
-
throw e
|
|
270
|
-
})
|
|
271
|
-
}
|
|
272
|
-
</script>
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
## Utilizar nominatim.openstreetmap.org para la busqueda de direcciones
|
|
277
|
-
```typescript
|
|
278
|
-
<template>
|
|
279
|
-
<div>
|
|
280
|
-
<MapSearchAddress :coordinatesMap="coordinatesMap" @updated:coordsMarker="getCoodMarker"
|
|
281
|
-
ref="mapRef"
|
|
282
|
-
/>
|
|
283
|
-
</div>
|
|
284
|
-
</template>
|
|
285
|
-
|
|
286
|
-
<script setup lang="ts">
|
|
287
|
-
|
|
288
|
-
const configurationMap: IConfigurationMap = {
|
|
289
|
-
height: "500px",
|
|
290
|
-
maxZoom: 19,
|
|
291
|
-
renderMarker:true,
|
|
292
|
-
dragMarker:false,
|
|
293
|
-
iconMarker: {
|
|
294
|
-
iconUrl: "https://cdn.onlinewebfonts.com/svg/img_466240.png",
|
|
295
|
-
iconSize: [25, 41],
|
|
296
|
-
iconAnchor: [12, 41],
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const mapRef = ref()
|
|
301
|
-
|
|
302
|
-
const coordinatesMap = ref({
|
|
303
|
-
lat: -19.0382054,
|
|
304
|
-
lng: -65.2662444,
|
|
305
|
-
zoom: 15,
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
const getCoodMarker = ({ lat, lng }: { lat: number; lng: number }) => {
|
|
309
|
-
console.log("coord", lat, lng);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
// mapRef.value.searchAddress(query:string)
|
|
313
|
-
// mapRef.value.searchAddress("Bolivia, Sucre, Bustillos 282");
|
|
314
|
-
// En caso de encontrar una dirección, envia el marcador a la nueva posición y actualiza
|
|
315
|
-
// el marcador via el emit @updated:coordsMarker
|
|
316
|
-
|
|
317
|
-
</script>
|
|
318
|
-
|
|
319
|
-
<style>
|
|
320
|
-
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
321
|
-
</style>
|
|
1
|
+
|
|
2
|
+
## Descripcion
|
|
3
|
+
|
|
4
|
+
Paquete para el uso de mapas con openstreetmap y geojson con VITE & VUE
|
|
5
|
+
|
|
6
|
+
## Instalacion
|
|
7
|
+
|
|
8
|
+
Instalacion del paquete
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm i vue-geojson-view-ts
|
|
12
|
+
```
|
|
13
|
+
## Configuracion Creacion de Polygonos
|
|
14
|
+
Configuracion para la creacion de polygonos dentro del mapa
|
|
15
|
+
```typescript
|
|
16
|
+
<template>
|
|
17
|
+
<div>
|
|
18
|
+
<MapView :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON" :getCoodMarker="getCoodMarker"></MapView>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { MapView } from 'vue-geojson-view-ts'
|
|
24
|
+
import { ref } from 'vue';
|
|
25
|
+
|
|
26
|
+
const iconMarker = {
|
|
27
|
+
iconUrl:'/images/icon.png'.
|
|
28
|
+
iconSize: [25, 41],
|
|
29
|
+
iconAnchor: [12, 41],
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const configurationMap = {
|
|
33
|
+
height:'500px',
|
|
34
|
+
iconMarker:{
|
|
35
|
+
iconUrl:'https://cdn.onlinewebfonts.com/svg/img_466240.png',
|
|
36
|
+
iconSize: [25, 41],
|
|
37
|
+
iconAnchor: [12, 41],
|
|
38
|
+
},
|
|
39
|
+
maxZoom:19,
|
|
40
|
+
renderMarker:true,
|
|
41
|
+
dragMarker:true,
|
|
42
|
+
createFigures:{
|
|
43
|
+
polygon: true,
|
|
44
|
+
circle: true,
|
|
45
|
+
rectangle: true,
|
|
46
|
+
marker:true,
|
|
47
|
+
},
|
|
48
|
+
editFigures:{
|
|
49
|
+
edit: true,
|
|
50
|
+
remove: true
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
54
|
+
|
|
55
|
+
const getGeoJSON = (geojson:any) =>{
|
|
56
|
+
console.log(geojson)
|
|
57
|
+
}
|
|
58
|
+
const getCoodMarker = (lat:number,long:number) =>{
|
|
59
|
+
console.log(lat,long)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style>
|
|
66
|
+
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
67
|
+
</style>
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuracion de vista o edicion de Polygonos
|
|
72
|
+
Configuracion para la edicion o solo vista de polygonos dentro del mapa
|
|
73
|
+
```typescript
|
|
74
|
+
<template>
|
|
75
|
+
<div>
|
|
76
|
+
<MapView :loadPolygon="true" :dataPolygon="dataPolygon" :reverseCoordinatesPolygon="true" :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON"></MapView>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script setup lang="ts">
|
|
81
|
+
import { MapView } from 'vue-geojson-view-ts'
|
|
82
|
+
import { ref } from 'vue';
|
|
83
|
+
|
|
84
|
+
const iconMarker = {
|
|
85
|
+
iconUrl:'/images/icon.png'.
|
|
86
|
+
iconSize: [25, 41],
|
|
87
|
+
iconAnchor: [12, 41],
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const configurationMap = {
|
|
91
|
+
height:'500px',
|
|
92
|
+
iconMarker:{
|
|
93
|
+
iconUrl:'https://cdn.onlinewebfonts.com/svg/img_466240.png',
|
|
94
|
+
iconSize: [25, 41],
|
|
95
|
+
iconAnchor: [12, 41],
|
|
96
|
+
},
|
|
97
|
+
maxZoom:19,
|
|
98
|
+
renderMarker:true,
|
|
99
|
+
dragMarker:false,
|
|
100
|
+
createFigures:{
|
|
101
|
+
polygon: false,
|
|
102
|
+
rectangle: false,
|
|
103
|
+
marker:false,
|
|
104
|
+
},
|
|
105
|
+
editFigures:{
|
|
106
|
+
edit: false,
|
|
107
|
+
remove: false
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
112
|
+
|
|
113
|
+
const getGeoJSON = (geojson:any) =>{
|
|
114
|
+
console.log(geojson)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const dataPolygon =[{"type":"Feature","properties":{},
|
|
118
|
+
"geometry":{"type":"Polygon","coordinates":[
|
|
119
|
+
[[-65.268488,-19.038266],[-65.25703,-19.034128],[-65.256085,-19.039361],[-65.268788,-19.043337],[-65.268488,-19.038266]]
|
|
120
|
+
]}}] //
|
|
121
|
+
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<style>
|
|
125
|
+
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
126
|
+
</style>
|
|
127
|
+
```
|
|
128
|
+
## Configuracion de Trigger click button Save Edit (Guardar Edicion de Polygonos)
|
|
129
|
+
Configuracion para ejecutar el disparador que guarda el polygono desde un boton fuera del mapa
|
|
130
|
+
```typescript
|
|
131
|
+
<template>
|
|
132
|
+
<div>
|
|
133
|
+
<button @click="SaveEdit">Trigger Save Edit</button>
|
|
134
|
+
<div style="display:flex;width: 100%;">
|
|
135
|
+
<div style="width:30%">
|
|
136
|
+
<MapView :loadPolygon="true" ref="Ref_MapView" :dataPolygon="dataPolygon" :reverseCoordinatesPolygon="true" :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON"></MapView>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<script setup lang="ts">
|
|
142
|
+
import {MapView} from "vue-geojson-view-ts"
|
|
143
|
+
import { ref } from "vue";
|
|
144
|
+
const Ref_MapView = ref();
|
|
145
|
+
const configurationMap = {
|
|
146
|
+
height:'500px',
|
|
147
|
+
iconMarker:{
|
|
148
|
+
iconUrl:'https://cdn.onlinewebfonts.com/svg/img_466240.png',
|
|
149
|
+
iconSize: [25, 41],
|
|
150
|
+
iconAnchor: [12, 41],
|
|
151
|
+
},
|
|
152
|
+
maxZoom:19,
|
|
153
|
+
renderMarker:true,
|
|
154
|
+
dragMarker:false,
|
|
155
|
+
createFigures:{
|
|
156
|
+
polygon: false,
|
|
157
|
+
rectangle: false,
|
|
158
|
+
marker:false,
|
|
159
|
+
},
|
|
160
|
+
editFigures:{
|
|
161
|
+
edit: true,
|
|
162
|
+
remove: true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const coordinatesMap = [-19.0382054,-65.2662444,13]
|
|
166
|
+
|
|
167
|
+
const getGeoJSON = (geojson:any) =>{
|
|
168
|
+
////Los datos seran enviados a este callback desde el boton dentro del mapa como desde el TRIGGER
|
|
169
|
+
console.log("geojson",geojson)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const SaveEdit = () =>{
|
|
173
|
+
Ref_MapView.value.triggerSaveEdit()
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const getLayersFeatures = () =>{
|
|
177
|
+
const getLayersToGeoJson = Ref_MapView.value.getLayersFeaturesInGeoJson()
|
|
178
|
+
console.log(getLayersToGeoJson)
|
|
179
|
+
}
|
|
180
|
+
</script>
|
|
181
|
+
```
|
|
182
|
+
## Configuracion de Marcador o Puntero dentro de polygono
|
|
183
|
+
Configuracion para ver si un punto esta dentro de un polygono
|
|
184
|
+
```typescript
|
|
185
|
+
<template>
|
|
186
|
+
<div>
|
|
187
|
+
<CoordinatesVerifyPolygon :dataPolygon="dataPolygon" :coordinatesMap="coordinatesMap" :iconMarker="iconMarker" :checkPointInPolygon = "checkPointInPolygon"/>
|
|
188
|
+
</div>
|
|
189
|
+
</template>
|
|
190
|
+
|
|
191
|
+
<script setup lang="ts">
|
|
192
|
+
|
|
193
|
+
const iconMarker = {
|
|
194
|
+
iconUrl:'/images/icon.png'.
|
|
195
|
+
iconSize: [25, 41],
|
|
196
|
+
iconAnchor: [12, 41],
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
200
|
+
|
|
201
|
+
const checkPointInPolygon = (check:Boolean) =>{
|
|
202
|
+
console.log(check)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const dataPolygon = {"type":"Feature","properties":{},
|
|
206
|
+
"geometry":{"type":"Polygon","coordinates":[
|
|
207
|
+
[[-65.268488,-19.038266],[-65.25703,-19.034128],[-65.256085,-19.039361],[-65.268788,-19.043337],[-65.268488,-19.038266]]
|
|
208
|
+
]}}
|
|
209
|
+
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<style>
|
|
213
|
+
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
214
|
+
</style>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## Utilizar Google Maps para la busqueda de direcciones
|
|
219
|
+
Configuracion para el uso del buscador de direcciones de googlemaps
|
|
220
|
+
#### IMP.- Por seguridad y uso solo de los sitios esperados... se debe enviar un parametro blts=listen por la url ej: http://localhost:8080/?blts=listen donde se quira utilizar la extension
|
|
221
|
+
|
|
222
|
+
#### 1.- Instalar la extension
|
|
223
|
+
##### a.- Dirijase a brave://extensions/ o chrome://extensions/
|
|
224
|
+
##### b.- Habilite la opcion desarrollador
|
|
225
|
+
##### c.- Luego clic en CARGAR DESCOMPRIMIDO
|
|
226
|
+
##### d.- Busque la extension descargada y descomprimido "GMI" de este repositorio
|
|
227
|
+
|
|
228
|
+
#### 2.- En su componente principal App.vue cargue listenServiceGoogleMaps este servicio escuchara cuando se abra y encuentre las coordenadas de su busqueda en google.
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import {listenServiceGoogleMaps} from 'vue-geojson-view-ts'
|
|
232
|
+
import { onMounted } from 'vue';
|
|
233
|
+
|
|
234
|
+
onMounted(() => {
|
|
235
|
+
listenServiceGoogleMaps()
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### 3.- Donde tenga cargado su Mapa importe su tipo de buscador que desea utilizar
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
<template>
|
|
244
|
+
<div>
|
|
245
|
+
<MapView :configurationMap="configurationMap" :coordinatesMap="coordinatesMap" :getGeoJSON="getGeoJSON" :getCoodMarker="getCoodMarker"></MapView>
|
|
246
|
+
</div>
|
|
247
|
+
<button @click="manualGoogleMaps">manual</button>
|
|
248
|
+
<button @click="automaticGoogleMaps">automatic</button>
|
|
249
|
+
</template>
|
|
250
|
+
|
|
251
|
+
<script setup lang="ts">
|
|
252
|
+
import {searchAutomaticGoogleMaps,searchManualGoogleMaps} from 'vue-geojson-view'
|
|
253
|
+
import { ref } from 'vue';
|
|
254
|
+
|
|
255
|
+
const coordinatesMap = ref([-19.0382054,-65.2662444,13])
|
|
256
|
+
|
|
257
|
+
const manualGoogleMaps = () =>{
|
|
258
|
+
searchManualGoogleMaps().then(cood =>{
|
|
259
|
+
coordinatesMap.value = cood
|
|
260
|
+
}).catch(e=>{
|
|
261
|
+
throw e
|
|
262
|
+
})
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const automaticGoogleMaps = () =>{
|
|
266
|
+
searchAutomaticGoogleMaps('Santa Cruz, Bolivia').then(cood=>{
|
|
267
|
+
coordinatesMap.value = cood
|
|
268
|
+
}).catch(e=>{
|
|
269
|
+
throw e
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
</script>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
## Utilizar nominatim.openstreetmap.org para la busqueda de direcciones
|
|
277
|
+
```typescript
|
|
278
|
+
<template>
|
|
279
|
+
<div>
|
|
280
|
+
<MapSearchAddress :coordinatesMap="coordinatesMap" @updated:coordsMarker="getCoodMarker"
|
|
281
|
+
ref="mapRef"
|
|
282
|
+
/>
|
|
283
|
+
</div>
|
|
284
|
+
</template>
|
|
285
|
+
|
|
286
|
+
<script setup lang="ts">
|
|
287
|
+
|
|
288
|
+
const configurationMap: IConfigurationMap = {
|
|
289
|
+
height: "500px",
|
|
290
|
+
maxZoom: 19,
|
|
291
|
+
renderMarker:true,
|
|
292
|
+
dragMarker:false,
|
|
293
|
+
iconMarker: {
|
|
294
|
+
iconUrl: "https://cdn.onlinewebfonts.com/svg/img_466240.png",
|
|
295
|
+
iconSize: [25, 41],
|
|
296
|
+
iconAnchor: [12, 41],
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const mapRef = ref()
|
|
301
|
+
|
|
302
|
+
const coordinatesMap = ref({
|
|
303
|
+
lat: -19.0382054,
|
|
304
|
+
lng: -65.2662444,
|
|
305
|
+
zoom: 15,
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
const getCoodMarker = ({ lat, lng }: { lat: number; lng: number }) => {
|
|
309
|
+
console.log("coord", lat, lng);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
// mapRef.value.searchAddress(query:string)
|
|
313
|
+
// mapRef.value.searchAddress("Bolivia, Sucre, Bustillos 282");
|
|
314
|
+
// En caso de encontrar una dirección, envia el marcador a la nueva posición y actualiza
|
|
315
|
+
// el marcador via el emit @updated:coordsMarker
|
|
316
|
+
|
|
317
|
+
</script>
|
|
318
|
+
|
|
319
|
+
<style>
|
|
320
|
+
@import url(/node_modules/vue-geojson-view-ts/dist/style.css);
|
|
321
|
+
</style>
|
|
322
322
|
```
|
|
@@ -119,7 +119,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
119
119
|
toBBoxString: () => string;
|
|
120
120
|
equals: (otherBounds: L.LatLngBoundsExpression, maxMargin?: number | undefined) => boolean;
|
|
121
121
|
isValid: () => boolean;
|
|
122
|
-
} | [number, number
|
|
122
|
+
} | [number, number][] | undefined;
|
|
123
123
|
noWrap?: boolean | undefined;
|
|
124
124
|
pane?: string | undefined;
|
|
125
125
|
className?: string | undefined;
|