@vidro/map-handler 1.2.12 → 1.2.19
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 +367 -48
- package/dist/map-handler.js +1 -1
- package/doc/confirmComponent.png +0 -0
- package/examples/full/apidemo.js +46 -43
- package/examples/full/cachedToken.dat +1 -1
- package/examples/full/cachedTokenData.dat +1 -1
- package/examples/full/docker/Docker_compose.yml +14 -0
- package/examples/full/docker/Dockerfile +27 -0
- package/examples/full/index.php +5 -4
- package/examples/full/tester.css +74 -0
- package/examples/full/tester.js +2 -2
- package/examples/react-next/README.md +282 -0
- package/examples/react-next/components/AuthComponent.js +88 -0
- package/examples/react-next/components/MapButtons.js +161 -0
- package/examples/react-next/components/MapFilters.js +120 -0
- package/examples/react-next/components/MapIframe.js +25 -0
- package/examples/react-next/components/MapInfo.js +36 -0
- package/examples/react-next/components/MapLayers.js +60 -0
- package/examples/react-next/components/MapList.js +43 -0
- package/examples/react-next/contexts/auth.js +101 -0
- package/examples/react-next/contexts/maps.js +158 -0
- package/examples/react-next/contexts/messages.js +340 -0
- package/examples/react-next/env.sample +3 -0
- package/examples/react-next/eslint.config.mjs +14 -0
- package/examples/react-next/hooks/useMapEvents.js +118 -0
- package/examples/react-next/jsconfig.json +7 -0
- package/examples/react-next/next.config.mjs +6 -0
- package/examples/react-next/package.json +24 -0
- package/examples/react-next/pages/_app.js +5 -0
- package/examples/react-next/pages/index.js +87 -0
- package/examples/react-next/postcss.config.mjs +8 -0
- package/examples/react-next/public/discord.svg +8 -0
- package/examples/react-next/public/favicon.ico +0 -0
- package/examples/react-next/public/file.svg +1 -0
- package/examples/react-next/public/logo.png +0 -0
- package/examples/react-next/public/next.svg +1 -0
- package/examples/react-next/shared/constants.js +47 -0
- package/examples/react-next/styles/globals.css +24 -0
- package/examples/react-next/tailwind.config.mjs +17 -0
- package/helpers.md +45 -0
- package/package.json +1 -1
- package/src/index.js +263 -23
package/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Map Handler
|
2
2
|
|
3
|
-
#### Version 1.2.
|
3
|
+
#### Version 1.2.180 - February 2025
|
4
4
|
|
5
5
|
Tool to achieve the easiest way of communication with the map iframe.
|
6
6
|
|
@@ -99,21 +99,51 @@ setDebug(0);
|
|
99
99
|
|
100
100
|
### Available events
|
101
101
|
|
102
|
+
### Available Events
|
103
|
+
|
102
104
|
##### onZoomChange
|
103
105
|
|
104
|
-
|
106
|
+
The `onZoomChange` event is triggered whenever the zoom level of the map changes. This event provides detailed metadata about the new zoom state, including the current zoom level, map extent, resolution, and scale.
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
The event returns an object with the following properties:
|
111
|
+
|
112
|
+
| Property | Type | Description |
|
113
|
+
|-------------|--------|-------------|
|
114
|
+
| `type` | string | The event type, always `"onZoomChange"`. |
|
115
|
+
| `zoom` | number | The current zoom level after the change. |
|
116
|
+
| `maxZoom` | number | The maximum zoom level allowed in the map. |
|
117
|
+
| `minZoom` | number | The minimum zoom level allowed in the map. |
|
118
|
+
| `extent` | array | The map extent after zooming, represented as `[minX, minY, maxX, maxY]`. |
|
119
|
+
| `resolution` | number | The resolution of the map at the current zoom level. |
|
120
|
+
| `scale` | string | The approximate scale of the map in the format `"1:xxxx"`. |
|
121
|
+
|
122
|
+
|
123
|
+
```
|
124
|
+
{
|
125
|
+
"type": "onZoomChange",
|
126
|
+
"zoom": 15.035190437015496,
|
127
|
+
"maxZoom": 25,
|
128
|
+
"minZoom": 0,
|
129
|
+
"extent": [448455.99940588913, 4595273.644846473, 456909.8853950997, 4602082.14362973],
|
130
|
+
"resolution": 4.656975911940399,
|
131
|
+
"scale": "1:17600"
|
132
|
+
}
|
133
|
+
```
|
105
134
|
|
106
135
|
##### geomAdded
|
107
136
|
|
108
137
|
Notifies geometry added to map and featureId
|
109
138
|
|
110
|
-
When this tool is used, NO geom is added when drawing finishes. In case you want to add it, use `Highlight` tool
|
111
|
-
|
139
|
+
When this tool is used, NO geom is added when drawing finishes. In case you want to add it, use `Highlight` tool
|
112
140
|
|
113
141
|
> E.G.
|
114
142
|
|
115
143
|
```
|
116
144
|
geom_astext: "POLYGON((418391.8715694032 4576832.484383419,418721.82301488414 4577299.667608328,418727.18131229794 4576947.724919814,418391.8715694032 4576832.484383419))"
|
145
|
+
featureId: "uuid of geometry added'
|
146
|
+
srid: 'EPSG:25831'
|
117
147
|
```
|
118
148
|
|
119
149
|
##### loaded
|
@@ -124,8 +154,10 @@ There're two types of events:
|
|
124
154
|
|
125
155
|
- `map` is dispatched when map (with background) is loaded.
|
126
156
|
- `layer` is dispatched when a layer is loaded
|
157
|
+
- `zIndex`: layer z-index
|
127
158
|
- `tiled` is dispatched when a tiled is loaded
|
128
159
|
|
160
|
+
|
129
161
|
> `map` E.G:
|
130
162
|
|
131
163
|
```
|
@@ -136,7 +168,8 @@ There're two types of events:
|
|
136
168
|
|
137
169
|
```
|
138
170
|
{what:'layer'
|
139
|
-
name:'Arc'
|
171
|
+
name:'Arc'
|
172
|
+
zIndex:998}
|
140
173
|
```
|
141
174
|
|
142
175
|
##### unloaded
|
@@ -181,14 +214,19 @@ Formatted Layers TOC (table of contents)
|
|
181
214
|
|
182
215
|
##### coordinates
|
183
216
|
|
184
|
-
Notifies clicked coordinates (x,y)
|
217
|
+
Notifies clicked coordinates (x,y), a BBOX in WKT and map srid
|
218
|
+
|
219
|
+
BBOX by default is a 20m box. You can customize this value with method `setBboxSize`
|
185
220
|
|
186
221
|
First coordinate is X value.
|
187
222
|
|
188
223
|
> E.G:
|
189
224
|
|
190
225
|
```
|
191
|
-
{
|
226
|
+
{
|
227
|
+
coordinates: (2) [419463.63262834214, 4577166.970846243],
|
228
|
+
bbox: "POLYGON((452249.04604797193 4599115.704682493,452254.04604797193 4599115.704682493,452254.04604797193 4599120.704682493,452249.04604797193 4599120.704682493,452249.04604797193 4599115.704682493))",
|
229
|
+
srid: "EPSG:25831",
|
192
230
|
type: "coordinates"}
|
193
231
|
```
|
194
232
|
|
@@ -265,6 +303,32 @@ Notifies errors
|
|
265
303
|
|
266
304
|
Notifies map status, as tiled loaded, background visible, etc..
|
267
305
|
|
306
|
+
##### hover
|
307
|
+
|
308
|
+
When user puts mouse pointer over a feauture for more than 1 second, a `hover` event is dispatched.
|
309
|
+
|
310
|
+
If is no hover any feature event is dispatched with `feature:null`
|
311
|
+
|
312
|
+
|
313
|
+
> E.G
|
314
|
+
|
315
|
+
```
|
316
|
+
|
317
|
+
{type: "hover", feature: {'property':'somevalue',...}
|
318
|
+
```
|
319
|
+
|
320
|
+
##### screenshot <a id="screenshot-event"></a>
|
321
|
+
|
322
|
+
This feature provides screenshot data, encoded as a PNG in Base64 format.
|
323
|
+
|
324
|
+
|
325
|
+
> E.G
|
326
|
+
|
327
|
+
```
|
328
|
+
|
329
|
+
{type: "screenshot", content: 'png in base64'
|
330
|
+
```
|
331
|
+
|
268
332
|
## Methods
|
269
333
|
|
270
334
|
##### ZoomIn()
|
@@ -289,7 +353,26 @@ Zooms to given coordinates
|
|
289
353
|
zoomToCoordinates(419006.12985785044, 4576698.8136144625,18);
|
290
354
|
|
291
355
|
```
|
292
|
-
|
356
|
+
|
357
|
+
##### zoomToGeometry
|
358
|
+
|
359
|
+
Zooms to a given geometry
|
360
|
+
|
361
|
+
> Params
|
362
|
+
|
363
|
+
- geom `<string>` WKT geometry
|
364
|
+
- limits `<json>` max/min zoom level
|
365
|
+
- max `<integer>`
|
366
|
+
- min `<integer>`
|
367
|
+
|
368
|
+
> E.G.
|
369
|
+
|
370
|
+
```
|
371
|
+
zoomToCoordinates(419006.12985785044, 4576698.8136144625,18);
|
372
|
+
|
373
|
+
```
|
374
|
+
|
375
|
+
##### zoomToGeometry(lat,long)
|
293
376
|
|
294
377
|
center map to given coordinates
|
295
378
|
|
@@ -304,6 +387,35 @@ center map to given coordinates
|
|
304
387
|
CenterMap(419006.12985785044, 4576698.8136144625,18);
|
305
388
|
|
306
389
|
```
|
390
|
+
##### zoomToScale(scale)
|
391
|
+
|
392
|
+
Sets the zoom level to a specified scale.
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
> **Allowed Scales:**
|
397
|
+
|
398
|
+
- `1:100`
|
399
|
+
- `1:200`
|
400
|
+
- `1:400`
|
401
|
+
- `1:500`
|
402
|
+
- `1:1000`
|
403
|
+
- `1:2000`
|
404
|
+
- `1:5000`
|
405
|
+
- `1:10000`
|
406
|
+
- `1:50000`
|
407
|
+
|
408
|
+
> Params
|
409
|
+
|
410
|
+
- **`scale`** `<string>` - The scale to set the zoom level.
|
411
|
+
|
412
|
+
|
413
|
+
E.G:
|
414
|
+
|
415
|
+
```javascript
|
416
|
+
zoomToScale('1:100');
|
417
|
+
```
|
418
|
+
|
307
419
|
|
308
420
|
##### AddGeom(string)
|
309
421
|
|
@@ -320,10 +432,24 @@ Optional parameters
|
|
320
432
|
- `continnue`:(`string`): E.G. "Click to to continue drawing"
|
321
433
|
- `center` (`object`): Center options.
|
322
434
|
- `style` (`object`):
|
323
|
-
|
324
|
-
|
435
|
+
- `fill` (`string`): The fill color for the drawn geometry.
|
436
|
+
- `stroke` (`string`): The stroke color for the drawn geometry.
|
325
437
|
- `drawOnEnd` (`boolean`): Is is set to `false` geometry will not be added on end drawing. The event with the drawn geometry will still be emitted
|
438
|
+
- `showConfirm` (`boolean`): show or hide component for end drawing. If is set to false, `CancelAddGeom()` must be handled by the user.
|
439
|
+
|
440
|
+
Confirm component:
|
441
|
+

|
442
|
+
|
443
|
+
#### CancelAddGeom
|
326
444
|
|
445
|
+
Cancels draw geometry
|
446
|
+
|
447
|
+
> E.G.
|
448
|
+
|
449
|
+
```
|
450
|
+
CancelAddGeom();
|
451
|
+
|
452
|
+
```
|
327
453
|
|
328
454
|
> E.G.
|
329
455
|
|
@@ -333,19 +459,52 @@ AddGeom('Point');
|
|
333
459
|
AddGeom('Line');
|
334
460
|
|
335
461
|
AddGeom('Polygon');
|
462
|
+
|
463
|
+
//Draw polygon with no showConfirm
|
464
|
+
AddGeom('Polygon', {showConfirm: false});
|
336
465
|
```
|
337
466
|
|
338
467
|
An `geomAdded` event will be received after calling the method.
|
339
468
|
|
469
|
+
##### addIcon(icon,coordinates)
|
470
|
+
|
471
|
+
Add an icon on a given coordinates
|
472
|
+
|
473
|
+
> Params
|
474
|
+
|
475
|
+
- icon `<ArrayBuffer>` - The binary data of the icon image, typically obtained by converting an image file (e.g., PNG) to an `ArrayBuffer`. This should represent the visual marker to be displayed on the map.
|
476
|
+
- coordintes `<array>` - An array specifying the location where the icon should be added. Format: `[longitude, latitude]`. Ensure the coordinates are in the same SRID (Spatial Reference Identifier) as the map being used (e.g., EPSG:4326 for geographic coordinates). Transform the coordinates if necessary before passing them to this method.
|
477
|
+
|
478
|
+
```
|
479
|
+
|
480
|
+
// Fetch and process the image as binary data
|
481
|
+
const iconBinaryData = convert to binary method (`path/images/icons/anIcon.png`);
|
482
|
+
|
483
|
+
addIcon(iconBinaryData, [2, 4.6]);
|
484
|
+
|
485
|
+
```
|
486
|
+
[ArrayBuffer conversion examples](helpers.md)
|
487
|
+
|
488
|
+
|
489
|
+
##### setBboxSize
|
490
|
+
|
491
|
+
Set the BBOX size of clicked coordinates. When the receives a click events, calculates an bounding box of bboxsize meters.
|
492
|
+
|
493
|
+
> E.G.
|
494
|
+
|
495
|
+
```
|
496
|
+
setBboxSize(5); //set a bbox of 5 meters
|
497
|
+
```
|
498
|
+
|
340
499
|
##### clear()
|
341
500
|
|
342
501
|
Clears drawn geometries
|
343
502
|
|
344
503
|
##### toggleLayer
|
345
504
|
|
346
|
-
Shows/hides a layer.
|
505
|
+
Shows/hides a layer.
|
347
506
|
|
348
|
-
|
507
|
+
**\*Important**
|
349
508
|
|
350
509
|
This method loads a single layer. If you need to load multiple layers, use `loadMultipleLayers()` method
|
351
510
|
|
@@ -382,11 +541,17 @@ With properties
|
|
382
541
|
toggleLayer('somelayer_name', {gutter: 10, transparent: false, singletile: false);
|
383
542
|
```
|
384
543
|
|
544
|
+
##### toggleGroup
|
545
|
+
|
546
|
+
Toggles (show/hide) a list of layers. Layers must be loaded before with `loadMultipleLayers`
|
547
|
+
|
548
|
+
- ## layers `<array>`:
|
549
|
+
|
385
550
|
##### loadMultipleLayers()
|
386
551
|
|
387
552
|
Loads multiple layers. Use this method if you want to load multiple layers.
|
388
553
|
|
389
|
-
>Params
|
554
|
+
> Params
|
390
555
|
|
391
556
|
- layers `<array>`: array of layers, each layer with same proerties than `toggleLayer` method.
|
392
557
|
|
@@ -400,6 +565,27 @@ Sets a layer as acticve layer, used for infos
|
|
400
565
|
setActiveLayer('somelayer_name');
|
401
566
|
```
|
402
567
|
|
568
|
+
##### removeLayer(layer_name)
|
569
|
+
|
570
|
+
Removes a layer
|
571
|
+
|
572
|
+
> E.G.
|
573
|
+
|
574
|
+
```
|
575
|
+
removeLayer('somelayer_name');
|
576
|
+
```
|
577
|
+
|
578
|
+
##### displayLayer(layer_name)
|
579
|
+
|
580
|
+
Displays a layer
|
581
|
+
|
582
|
+
> E.G.
|
583
|
+
|
584
|
+
```
|
585
|
+
displayLayer('somelayer_name');
|
586
|
+
```
|
587
|
+
|
588
|
+
|
403
589
|
##### reloadDisplayedLayers
|
404
590
|
|
405
591
|
Reloads displayed layers
|
@@ -422,6 +608,34 @@ loadWMSAvailableLayers();
|
|
422
608
|
|
423
609
|
An `availableWMSLayers ` event will be received after calling the method.
|
424
610
|
|
611
|
+
##### bringLayerToTop
|
612
|
+
|
613
|
+
> Params
|
614
|
+
|
615
|
+
- layer_name `<string>`: layer name
|
616
|
+
|
617
|
+
Brings layer to top.
|
618
|
+
|
619
|
+
> E.G.
|
620
|
+
|
621
|
+
```
|
622
|
+
bringLayerToTop('somelayer_name');
|
623
|
+
```
|
624
|
+
|
625
|
+
##### bringLayerToBottom
|
626
|
+
|
627
|
+
> Params
|
628
|
+
|
629
|
+
- layer_name `<string>`: layer name
|
630
|
+
|
631
|
+
Brings layer to bottom.
|
632
|
+
|
633
|
+
> E.G.
|
634
|
+
|
635
|
+
```
|
636
|
+
bringLayerToBottom('somelayer_name');
|
637
|
+
```
|
638
|
+
|
425
639
|
##### getToc
|
426
640
|
|
427
641
|
Gets a formatted Layers TOC (Table of contents)
|
@@ -491,12 +705,15 @@ Geolocalizes user. Will dispatch `geolocation` event .
|
|
491
705
|
> Params
|
492
706
|
|
493
707
|
- toggle `<Boolean>` - starts or cancels geolocation
|
708
|
+
- options `<json>` - optional
|
709
|
+
- track `<Boolean>` - will track user position or geolocalize only once
|
494
710
|
|
495
711
|
> E.G.
|
496
712
|
|
497
713
|
```
|
498
714
|
//start
|
499
715
|
Geolocalize(true)
|
716
|
+
Geolocalize(true, {track:true})
|
500
717
|
|
501
718
|
//cancel
|
502
719
|
Geolocalize(false)
|
@@ -506,7 +723,8 @@ Geolocalize(false)
|
|
506
723
|
|
507
724
|
##### Higlight
|
508
725
|
|
509
|
-
Highlights
|
726
|
+
Highlights & draws a geometry. Allows animation and zoom to element.
|
727
|
+
If you want to draw a geom, just use `DrawGeometries` method
|
510
728
|
|
511
729
|
Params
|
512
730
|
|
@@ -520,21 +738,24 @@ Optional parameters
|
|
520
738
|
- `element`: Zoom to the center of the geometry.
|
521
739
|
- `zoomLevel` (`number`, optional): The zoom level (1 to 28). Required if `type` is set to `level`.
|
522
740
|
- `center` (`object`): Center options.
|
741
|
+
- `false` will not center map to element
|
742
|
+
- `1` will center always map to element
|
743
|
+
- `2` will center element only if is outside current view extent
|
523
744
|
- `data` (`object`): Additional data associated with the highlight.
|
524
745
|
- `feautureId` (`string`): The ID of the feature.
|
525
746
|
- `name` (`string`): The name of the feature.
|
747
|
+
- ... any extra data will be added to feature
|
526
748
|
- style (`object`): geometry styling options
|
527
|
-
|
528
|
-
|
749
|
+
- `fill` (`string`): The fill color for the highlighted geometry.
|
750
|
+
- `stroke` (`string`): The stroke color for the highlighted geometry.
|
529
751
|
- `animate` (`boolean`): Indicates whether to animate the highlight.
|
530
|
-
|
531
|
-
|
752
|
+
- `duration`: time of the animation in milliseconds
|
753
|
+
- `repeat`: true/false for repeteating animation
|
532
754
|
|
533
755
|
Example of animation
|
534
756
|
|
535
757
|

|
536
758
|
|
537
|
-
|
538
759
|
> E.G.
|
539
760
|
|
540
761
|
```
|
@@ -562,30 +783,11 @@ let options = {
|
|
562
783
|
Highlight(options);
|
563
784
|
```
|
564
785
|
|
565
|
-
##### DrawGeometry
|
566
|
-
|
567
|
-
Draws a geometry
|
786
|
+
##### DrawGeometry - DEPRECATED
|
568
787
|
|
569
|
-
|
788
|
+
**use `DrawGeometries`**
|
570
789
|
|
571
|
-
|
572
|
-
- style `<object>`
|
573
|
-
- stroke_color `<string>`
|
574
|
-
- fill_color `<string>`
|
575
|
-
- geom_radius `<integer>`
|
576
|
-
- stroke_width `<integer>`
|
577
|
-
- font_color `<string>`
|
578
|
-
- font `<string>`
|
579
|
-
- placement `<string>`
|
580
|
-
- fontFillColor `<string>`
|
581
|
-
- fontStrokeColor `<string>`
|
582
|
-
- display `<string>`
|
583
|
-
- fontStrokeWidth `<integer>`
|
584
|
-
- offsetY `<integer>`
|
585
|
-
- baseline `<string>`
|
586
|
-
- align `<string>`
|
587
|
-
- name `<string>` feauture name
|
588
|
-
- id `<string>` feauture id
|
790
|
+
Draws a single geometry, in case you want to draw multiple geometries simultaneusly use `DrawGeometries ` method
|
589
791
|
|
590
792
|
> E.G.
|
591
793
|
|
@@ -602,9 +804,52 @@ const style = {
|
|
602
804
|
DrawGeometry(geom,style,'sampleName','mockId');
|
603
805
|
|
604
806
|
```
|
605
|
-
##### RemoveGeometry
|
606
807
|
|
607
|
-
|
808
|
+
##### DrawGeometries
|
809
|
+
|
810
|
+
Draws geometries
|
811
|
+
|
812
|
+
> Params
|
813
|
+
|
814
|
+
- geoms `<array>`:
|
815
|
+
- item `<object>`:
|
816
|
+
- geom `<string>` - geometry string
|
817
|
+
- style `<object>`
|
818
|
+
- stroke_color `<string>`
|
819
|
+
- fill_color `<string>`
|
820
|
+
- geom_radius `<integer>`
|
821
|
+
- stroke_width `<integer>`
|
822
|
+
- font_color `<string>`
|
823
|
+
- font `<string>`
|
824
|
+
- placement `<string>`
|
825
|
+
- fontFillColor `<string>`
|
826
|
+
- fontStrokeColor `<string>`
|
827
|
+
- display `<string>`
|
828
|
+
- fontStrokeWidth `<integer>`
|
829
|
+
- offsetY `<integer>`
|
830
|
+
- baseline `<string>`
|
831
|
+
- align `<string>`
|
832
|
+
- name `<string>` feauture name
|
833
|
+
- id `<string>` feauture id
|
834
|
+
|
835
|
+
> E.G.
|
836
|
+
|
837
|
+
```
|
838
|
+
//Draw a geometry with yellow stroke
|
839
|
+
|
840
|
+
const geom = 'MULTILINESTRING((418596.62555076234 4577083.383681167,419026.2319996517 4577216.795306675))'
|
841
|
+
|
842
|
+
const style = {
|
843
|
+
stroke_color: "rgb(233, 244, 75)"
|
844
|
+
}
|
845
|
+
}
|
846
|
+
const item = {geom,style,'sampleName','mockId'};
|
847
|
+
DrawGeometries([item]);
|
848
|
+
```
|
849
|
+
|
850
|
+
##### RemoveGeometry
|
851
|
+
|
852
|
+
Removes a geometry by ID
|
608
853
|
|
609
854
|
Params
|
610
855
|
|
@@ -617,6 +862,41 @@ Params
|
|
617
862
|
RemoveGeometry('25', 'somlayer')
|
618
863
|
```
|
619
864
|
|
865
|
+
##### RemoveGeometriesByProperty
|
866
|
+
|
867
|
+
Removes geometries by property value
|
868
|
+
|
869
|
+
Params
|
870
|
+
|
871
|
+
- layer `<string>` - layer name, optional
|
872
|
+
- property `<string>` - property name
|
873
|
+
- value - property value
|
874
|
+
|
875
|
+
> E.G.
|
876
|
+
|
877
|
+
```
|
878
|
+
RemoveGeometriesByProperty( 'somlayer','type','something')
|
879
|
+
```
|
880
|
+
|
881
|
+
##### UpdateGeometriesByProperty
|
882
|
+
|
883
|
+
Update geometry style based on property value
|
884
|
+
|
885
|
+
Params
|
886
|
+
|
887
|
+
- layer `<string>` - layer name, optional
|
888
|
+
- property `<string>` - property name
|
889
|
+
- value - property value
|
890
|
+
- style `<object>` - stroke_color `<string>` - fill_color `<string>` - geom_radius `<integer>` - stroke_width `<integer>` - font_color `<string>` - font `<string>` - placement `<string>` - fontFillColor `<string>` - fontStrokeColor `<string>` - display `<string>` - fontStrokeWidth `<integer>` - offsetY `<integer>` - baseline `<string>` - align `<string>`
|
891
|
+
|
892
|
+
> E.G.
|
893
|
+
|
894
|
+
```
|
895
|
+
UpdateGeometriesByProperty( 'somlayer','type','something',{
|
896
|
+
stroke_color: "rgb(255, 0, 0)"}
|
897
|
+
)
|
898
|
+
```
|
899
|
+
|
620
900
|
##### toggleTiled
|
621
901
|
|
622
902
|
Deprecated `toggleGiswaterTiled`
|
@@ -637,14 +917,12 @@ toggleTiled(true);
|
|
637
917
|
|
638
918
|
##### toggleSecondaryBackground
|
639
919
|
|
640
|
-
|
641
920
|
Toggles secondary background (in case secondary background is configured)
|
642
921
|
|
643
922
|
Params
|
644
923
|
|
645
924
|
- toggle `<boolean>` shows/hides secondary background
|
646
925
|
|
647
|
-
|
648
926
|
> E.G.
|
649
927
|
|
650
928
|
```
|
@@ -652,7 +930,6 @@ toggleSecondaryBackground(true);
|
|
652
930
|
|
653
931
|
```
|
654
932
|
|
655
|
-
|
656
933
|
##### addGeoJSON
|
657
934
|
|
658
935
|
Adds geoJSON layer
|
@@ -706,13 +983,23 @@ clearGeoJSON();
|
|
706
983
|
```
|
707
984
|
|
708
985
|
##### setFilters
|
709
|
-
Deprecated `setGiswaterFilters`
|
710
986
|
|
987
|
+
Deprecated `setGiswaterFilters`
|
711
988
|
|
712
989
|
Set filters for displayed layers
|
713
990
|
|
714
991
|
Filters must be a JSON with valid fields. On Giswater/QGIS projects, available layer filters can be obtained with method `getGiswaterLayerAvailableFilters`
|
715
992
|
|
993
|
+
Each filter must have this format:
|
994
|
+
|
995
|
+
- layer_id <integer>
|
996
|
+
- layer*name <string> - *`qgis_name` property\_
|
997
|
+
- filters: <array>
|
998
|
+
- name <string>: field name
|
999
|
+
- condition <string>: `=`,`!=`,`<`,`>`,`<=`,`>=`,`in`,`between`
|
1000
|
+
- value: value to be filtered
|
1001
|
+
- value2: second value, only for `between` conditions
|
1002
|
+
|
716
1003
|
```
|
717
1004
|
setFilters(JSON);
|
718
1005
|
```
|
@@ -720,7 +1007,32 @@ setFilters(JSON);
|
|
720
1007
|
> E.G.
|
721
1008
|
|
722
1009
|
```
|
723
|
-
setFilters(
|
1010
|
+
setFilters([
|
1011
|
+
{
|
1012
|
+
layer_id: 1,
|
1013
|
+
layer_name: "mylayer",
|
1014
|
+
filters: [
|
1015
|
+
{
|
1016
|
+
name: 'exp_id',
|
1017
|
+
condition: 'in',
|
1018
|
+
value: "'1','4'",
|
1019
|
+
value2: null
|
1020
|
+
},
|
1021
|
+
{
|
1022
|
+
name: 'status',
|
1023
|
+
condition: '=',
|
1024
|
+
value: 'active',
|
1025
|
+
value2: null
|
1026
|
+
},
|
1027
|
+
{
|
1028
|
+
name: 'anotherField',
|
1029
|
+
condition: 'between',
|
1030
|
+
value: '100',
|
1031
|
+
value2: '200'
|
1032
|
+
}
|
1033
|
+
]
|
1034
|
+
}
|
1035
|
+
]);
|
724
1036
|
```
|
725
1037
|
|
726
1038
|
##### getGiswaterLayerAvailableFilters
|
@@ -806,6 +1118,13 @@ Stop measure tools
|
|
806
1118
|
cancelMeasure();
|
807
1119
|
```
|
808
1120
|
|
1121
|
+
##### screenshot
|
1122
|
+
|
1123
|
+
Will do an screenshot of the current map encoded as a PNG in Base64 format. Result will be encapsulated [`screenshot`](#screenshot-event)
|
1124
|
+
|
1125
|
+
```
|
1126
|
+
screenshot({});
|
1127
|
+
```
|
809
1128
|
### Multiple iframes
|
810
1129
|
|
811
1130
|
Is possible to use multiple iframe on a single page, follow this steps.
|