forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openlayers.d.ts
4737 lines (3889 loc) · 166 KB
/
openlayers.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for OpenLayers v3.6.0
// Project: http://openlayers.org/
// Definitions by: Wouter Goedhart <https://github.com/woutergd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace olx {
interface StaticImageOptions {
/** Attributions */
attributions?: Array<ol.Attribution>
/*** The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */
crossOrigin?: string
/*** Extent of the image in map coordinates. This is the [left, bottom, right, top] map coordinates of your image.*/
imageExtent: ol.Extent;
/*** Size of the image in pixels.*/
imageSize?: ol.Size;
/*** experimental Optional function to load an image given a URL.*/
imageLoadFunction?: ol.TileLoadFunctionType;
/*** Optional logo.*/
logo?: olx.LogoOptions;
/*** experimental Projection.*/
projection: ol.proj.Projection;
/*** Image URL.*/
url: string;
}
interface ZoomToExtentOptions {
/*** Class name. Default is ol-zoom-extent.*/
className?: string;
/*** Target.*/
target?: Element;
/*** Text label to use for the button. Default is E. Instead of text, also a Node (e.g. a span element) can be used.*/
label?: string | Node;
/*** Text label to use for the button tip. Default is Zoom to extent.*/
tipLabel?: string;
/*** The extent to zoom to. If undefined the validity extent of the view projection is used.*/
extent: ol.Extent;
}
interface AttributionOptions {
/** HTML markup for this attribution. */
html: string;
}
interface DeviceOrientationOptions {
/**
* Start tracking. Default is false.
*/
tracking?: boolean;
}
interface FrameState {
/**
*
*/
pixelRatio: number;
/**
*
*/
time: number;
/**
*
*/
viewState: olx.ViewState;
}
interface FeatureOverlayOptions {
/**
* Features
*/
features?: Array<ol.Feature> | ol.Collection<ol.Feature> | ol.style.StyleFunction;
/**
* Map
*/
map: ol.Map;
/**
* Style
*/
style: ol.style.Style | Array<ol.style.Style>;
}
interface GeolocationOptions {
/**
* Start Tracking. Default is false.
*/
tracking?: boolean;
/**
* Tracking options. See http://www.w3.org/TR/geolocation-API/#position_options_interface.
*/
trackingOptions?: PositionOptions;
/**
* The projection the position is reported in.
*/
projection?: ol.proj.ProjectionLike | ol.proj.Projection;
}
interface GraticuleOptions {
/** Reference to an ol.Map object. */
map?: ol.Map;
/** The maximum number of meridians and parallels from the center of the map. The default value is 100, which means that at most 200 meridians and 200 parallels will be displayed. The default value is appropriate for conformal projections like Spherical Mercator. If you increase the value more lines will be drawn and the drawing performance will decrease. */
maxLines?: number;
/** The stroke style to use for drawing the graticule. If not provided, the lines will be drawn with rgba(0,0,0,0.2), a not fully opaque black. */
strokeStyle?: ol.style.Stroke;
/** The target size of the graticule cells, in pixels. Default value is 100 pixels. */
targetSize?: number;
}
interface BaseWMSOptions {
/** Attributions. */
attributions?: Array<ol.Attribution>;
/** WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically. */
params?: any;
/** The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */
crossOrigin?: string;
/** experimental Use the ol.Map#pixelRatio value when requesting the image from the remote server. Default is true. */
hidpi?: boolean;
/** experimental The type of the remote WMS server: mapserver, geoserver or qgis. Only needed if hidpi is true. Default is undefined. */
serverType?: ol.source.wms.ServerType;
/** WMS service URL. */
url?: string;
/** Logo. */
logo?: olx.LogoOptions;
/** experimental Projection. */
projection?: ol.proj.ProjectionLike;
}
interface ImageWMSOptions extends BaseWMSOptions {
/** experimental Optional function to load an image given a URL. */
imageLoadFunction?: ol.ImageLoadFunctionType;
/** Ratio. 1 means image requests are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher. Default is 1.5. */
ratio?: number;
/** Resolutions. If specified, requests will be made for these resolutions only. */
resolutions?: Array<number>;
}
interface TileWMSOptions {
attributions?: Array<ol.Attribution>;
/**WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically. Required.*/
params: Object;
/**The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.*/
crossOrigin?: string;
/** The size in pixels of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. Defaults to zero. Using a non-zero value allows artifacts of rendering at tile edges to be ignored. If you control the WMS service it is recommended to address "artifacts at tile edges" issues by properly configuring the WMS service. For example, MapServer has a tile_map_edge_buffer configuration parameter for this. See http://mapserver.org/output/tile_mode.html. */
gutter?: number;
/** Use the ol.Map#pixelRatio value when requesting the image from the remote server. Default is true.*/
hidpi?: boolean;
logo?: string | olx.LogoOptions;
/** Tile grid. Base this on the resolutions, tilesize and extent supported by the server. If this is not defined, a default grid will be used: if there is a projection extent, the grid will be based on that; if not, a grid based on a global extent with origin at 0,0 will be used. */
tileGrid?: ol.tilegrid.TileGrid;
/** experimental Maximum zoom. */
maxZoom?: number;
projection?: ol.proj.ProjectionLike;
reprojectionErrorThreshold?: number;
/** experimental Optional function to load a tile given a URL. */
tileLoadFunction?: ol.TileLoadFunctionType;
/** WMS service URL. */
url?: string;
/** WMS service urls. Use this instead of url when the WMS supports multiple urls for GetMap requests. */
urls?: Array<string>;
/** experimental The type of the remote WMS server. Currently only used when hidpi is true. Default is undefined. */
serverType?: ol.source.wms.ServerType;
/** experimental Whether to wrap the world horizontally. When set to false, only one world will be rendered. When true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds. The default is true. */
wrapX?: boolean;
}
/**
* Object literal with config options for the map logo.
*/
interface LogoOptions {
/**
* Link url for the logo. Will be followed when the logo is clicked.
*/
href: string;
/**
* Image src for the logo
*/
src: string;
}
interface MapOptions {
/** Controls initially added to the map. If not specified, ol.control.defaults() is used. */
controls?: any;
/** The ratio between physical pixels and device-independent pixels (dips) on the device. If undefined then it gets set by using window.devicePixelRatio. */
pixelRatio?: number;
/** Interactions that are initially added to the map. If not specified, ol.interaction.defaults() is used. */
interactions?: any;
/** The element to listen to keyboard events on. This determines when the KeyboardPan and KeyboardZoom interactions trigger. For example, if this option is set to document the keyboard interactions will always trigger. If this option is not specified, the element the library listens to keyboard events on is the map target (i.e. the user-provided div for the map). If this is not document the target element needs to be focused for key events to be emitted, requiring that the target element has a tabindex attribute. */
keyboardEventTarget?: any;
/** Layers. If this is not defined, a map with no layers will be rendered. Note that layers are rendered in the order supplied, so if you want, for example, a vector layer to appear on top of a tile layer, it must come after the tile layer. */
layers?: Array<any>
/** When set to true, tiles will be loaded during animations. This may improve the user experience, but can also make animations stutter on devices with slow memory. Default is false. */
loadTilesWhileAnimating?: boolean;
/** When set to true, tiles will be loaded while interacting with the map. This may improve the user experience, but can also make map panning and zooming choppy on devices with slow memory. Default is false. */
loadTilesWhileInteracting?: boolean;
/** The map logo. A logo to be displayed on the map at all times. If a string is provided, it will be set as the image source of the logo. If an object is provided, the src property should be the URL for an image and the href property should be a URL for creating a link. To disable the map logo, set the option to false. By default, the OpenLayers 3 logo is shown. */
logo?: any;
/** Overlays initially added to the map. By default, no overlays are added. */
overlays?: any;
/** Renderer. By default, Canvas, DOM and WebGL renderers are tested for support in that order, and the first supported used. Specify a ol.RendererType here to use a specific renderer. Note that at present only the Canvas renderer supports vector data. */
renderer?: any;
/** The container for the map, either the element itself or the id of the element. If not specified at construction time, ol.Map#setTarget must be called for the map to be rendered. */
target?: any;
/** The map's view. No layer sources will be fetched unless this is specified at construction time or through ol.Map#setView. */
view?: ViewOptions;
}
interface OverlayOptions {
/**
* The overlay element.
*/
element?: Element;
/**
* Offsets in pixels used when positioning the overlay. The fist element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down. Default is [0, 0].
*/
offset?: Array<number>;
/**
* The overlay position in map projection.
*/
position?: ol.Coordinate;
/**
* Defines how the overlay is actually positioned with respect to its position property. Possible values are 'bottom-left', 'bottom-center', 'bottom-right', 'center-left', 'center-center', 'center-right', 'top-left', 'top-center', and 'top-right'. Default is 'top-left'.
*/
positioning?: ol.OverlayPositioning;
/**
* Whether event propagation to the map viewport should be stopped. Default is true. If true the overlay is placed in the same container as that of the controls (CSS class name ol-overlaycontainer-stopevent); if false it is placed in the container with CSS class name ol-overlaycontainer.
*/
stopEvent?: boolean;
/**
* Whether the overlay is inserted first in the overlay container, or appended. Default is true. If the overlay is placed in the same container as that of the controls (see the stopEvent option) you will probably set insertFirst to true so the overlay is displayed below the controls.
*/
insertFirst?: boolean;
/**
* If set to true the map is panned when calling setPosition, so that the overlay is entirely visible in the current viewport. The default is false.
*/
autoPan?: boolean;
/**
* The options used to create a ol.animation.pan animation. This animation is only used when autoPan is enabled. By default the default options for ol.animation.pan are used. If set to null the panning is not animated.
*/
autoPanAnimation?: olx.animation.PanOptions;
/**
* The margin (in pixels) between the overlay and the borders of the map when autopanning. The default is 20.
*/
autoPanMargin?: number;
}
interface ViewOptions {
/** The initial center for the view. The coordinate system for the center is specified with the projection option. Default is undefined, and layer sources will not be fetched if this is not set. */
center?: ol.Coordinate;
/** Rotation constraint. false means no constraint. true means no constraint, but snap to zero near zero. A number constrains the rotation to that number of values. For example, 4 will constrain the rotation to 0, 90, 180, and 270 degrees. The default is true. */
constrainRotation?: boolean;
/** Enable rotation. Default is true. If false a rotation constraint that always sets the rotation to zero is used. The constrainRotation option has no effect if enableRotation is false. */
enableRotation?: boolean;
/**The extent that constrains the center, in other words, center cannot be set outside this extent. Default is undefined. */
extent?: ol.Extent;
/** The maximum resolution used to determine the resolution constraint. It is used together with minResolution (or maxZoom) and zoomFactor. If unspecified it is calculated in such a way that the projection's validity extent fits in a 256x256 px tile. If the projection is Spherical Mercator (the default) then maxResolution defaults to 40075016.68557849 / 256 = 156543.03392804097. */
maxResolution?: number;
/** The minimum resolution used to determine the resolution constraint. It is used together with maxResolution (or minZoom) and zoomFactor. If unspecified it is calculated assuming 29 zoom levels (with a factor of 2). If the projection is Spherical Mercator (the default) then minResolution defaults to 40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253. */
minResolution?: number;
/** The maximum zoom level used to determine the resolution constraint. It is used together with minZoom (or maxResolution) and zoomFactor. Default is 28. Note that if minResolution is also provided, it is given precedence over maxZoom. */
maxZoom?: number;
/** The minimum zoom level used to determine the resolution constraint. It is used together with maxZoom (or minResolution) and zoomFactor. Default is 0. Note that if maxResolution is also provided, it is given precedence over minZoom. */
minZoom?: number;
/** The projection. Default is EPSG:3857 (Spherical Mercator). */
projection?: ol.proj.ProjectionLike | ol.proj.Projection;
/** The initial resolution for the view. The units are projection units per pixel (e.g. meters per pixel). An alternative to setting this is to set zoom. Default is undefined, and layer sources will not be fetched if neither this nor zoom are defined. */
resolution?: number;
/** Resolutions to determine the resolution constraint. If set the maxResolution, minResolution, minZoom, maxZoom, and zoomFactor options are ignored. */
resolutions?: Array<number>;
/** The initial rotation for the view in radians (positive rotation clockwise). Default is 0. */
rotation?: number;
/** Only used if resolution is not defined. Zoom level used to calculate the initial resolution for the view. The initial resolution is determined using the ol.View#constrainResolution method. */
zoom?: number;
/** The zoom factor used to determine the resolution constraint. Default is 2. */
zoomFactor?: number;
}
interface ViewState {
/**
*
*/
center: ol.Coordinate;
/**
*
*/
projection: ol.proj.Projection;
/**
*
*/
resolution: number;
/**
*
*/
rotation: number;
}
interface Projection {
/**
* The SRS identifier code, e.g. EPSG:4326.
*/
code: string;
/**
* Units. Required unless a proj4 projection is defined for code.
*/
units?: ol.proj.Units;
/**
* The validity extent for the SRS.
*/
extent?: Array<number>;
/**
* The axis orientation as specified in Proj4. The default is enu.
*/
axisOrientation?: string;
/**
* Whether the projection is valid for the whole globe. Default is false.
*/
global?: boolean;
/**
* experimental The world extent for the SRS.
*/
worldExtent?: ol.Extent;
/**
* experimental Function to determine resolution at a point. The function is called with
* a {number} view resolution and an {ol.Coordinate} as arguments, and returns the {number}
* resolution at the passed coordinate.
*/
getPointResolution?: (resolution: number, coordinate: ol.Coordinate) => number;
}
namespace animation {
interface BounceOptions {
/**
* The resolution to start the bounce from, typically map.getView().getResolution().
*/
resolution: number;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number;
}
interface PanOptions {
/**
* The resolution to start the bounce from, typically map.getView().getResolution().
*/
source: ol.Coordinate;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number;
}
interface RotateOptions {
/**
* The rotation value (in radians) to begin rotating from, typically map.getView().getRotation(). If undefined then 0 is assumed.
*/
rotation?: number;
/**
* The rotation center/anchor. The map rotates around the center of the view if unspecified.
*/
anchor?: ol.Coordinate;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number
}
interface ZoomOptions {
/**
* The resolution to begin zooming from, typically map.getView().getResolution().
*/
resolution: number;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number
}
}
namespace control {
interface DefaultsOptions {
/**
* Attribution. Default is true.
*/
attribution?: boolean;
/**
* Attribution options.
*/
//TODO: Replace with olx.control.AttributionOptions
attributionOptions?: any;
/**
* Rotate. Default is true;
*/
rotate?: boolean;
/**
* Rotate options
*/
//TODO: Replace with olx.control.RotateOptions
rotateOptions?: any;
/**
* Zoom. Default is true
*/
zoom?: boolean;
/**
*
*/
//TODO: Replace with olx.control.ZoomOptions
zoomOptions?: any;
}
}
namespace interaction {
interface DefaultsOptions {
altShiftDragRotate?: boolean;
doubleClickZoom?: boolean;
keyboard?: boolean;
mouseWheelZoom?: boolean;
shiftDragZoom?: boolean;
dragPan?: boolean;
pinchRotate?: boolean;
pinchZoom?: boolean;
zoomDelta?: number;
zoomDuration?: number;
}
interface ModifyOptions {
deleteCondition?: ol.events.ConditionType;
pixelTolerance?: number;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
features: ol.Collection<ol.Feature>;
wrapX?: boolean;
}
interface DrawOptions {
clickTolerance?: number;
features?: ol.Collection<ol.Feature>;
source?: ol.source.Vector;
snapTolerance?: number;
type: ol.geom.GeometryType;
maxPoints?: number;
minPoints?: number;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
geometryFunction?: ol.interaction.DrawGeometryFunctionType;
wrapX?: boolean;
}
interface SelectOptions {
addCondition?: ol.events.ConditionType;
condition?: ol.events.ConditionType;
layers?: Array<ol.layer.Layer> | ((layer: ol.layer.Layer) => boolean);
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
removeCondition?: ol.events.ConditionType;
toggleCondition?: ol.events.ConditionType;
multi?: boolean;
features?: ol.Collection<ol.Feature>;
filter?: ol.interaction.SelectFilterFunction;
wrapX?: boolean;
}
}
namespace layer {
interface BaseOptions {
/**
* Opacity (0, 1). Default is 1.
*/
opacity?: number;
/**
* Visibility. Default is true.
*/
visible?: boolean;
/**
* The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
*/
extent?: ol.Extent;
zIndex?: number;
/**
* The minimum resolution (inclusive) at which this layer will be visible.
*/
minResolution?: number;
/**
* The maximum resolution (exclusive) below which this layer will be visible.
*/
maxResolution?: number;
}
interface GroupOptions extends BaseOptions {
/**
* Child layers
*/
layers?: Array<ol.layer.Base> | ol.Collection<ol.layer.Base>;
}
interface HeatmapOptions extends VectorOptions {
/**
* The color gradient of the heatmap, specified as an array of CSS color strings. Default is ['#00f', '#0ff', '#0f0', '#ff0', '#f00'].
*/
gradient?: Array<String>;
/**
* Radius size in pixels. Default is 8.
*/
radius?: number;
/**
* Blur size in pixels. Default is 15.
*/
blur?: number;
/**
* Shadow size in pixels. Default is 250.
*/
shadow?: number;
}
interface ImageOptions extends LayerOptions {
}
interface LayerOptions extends BaseOptions {
/**
* The layer source (or null if not yet set).
*/
source?: ol.source.Source;
}
interface TileOptions extends LayerOptions {
/**
* Preload. Load low-resolution tiles up to preload levels. By default preload is 0, which means no preloading.
*/
preload?: number;
/**
* Source for this layer.
*/
source?: ol.source.Tile;
/**
* Use interim tiles on error. Default is true.
*/
useInterimTilesOnError?: boolean;
}
interface VectorOptions extends LayerOptions {
/**
* When set to true, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to false, batches will be recreated when no animation is active. Default is false.
*/
updateWhileAnimating?: boolean;
/**
* When set to true, feature batches will be recreated during interactions. See also updateWhileInteracting. Default is false.
*/
updateWhileInteracting?: boolean;
/**
* Render order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Use null to avoid the sort, but get an undefined draw order.
*/
// TODO: replace any with the expected function, unclear in documentation what the parameters are
renderOrder?: any;
/**
* The buffer around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. Recommended value: the size of the largest symbol, line width or label. Default is 100 pixels.
*/
renderBuffer?: number;
/**
* Source.
*/
source?: ol.source.Vector;
/**
* Layer style. See ol.style for default style which will be used if this is not defined.
*/
style?: ol.style.Style | Array<ol.style.Style> | any;
}
}
namespace source {
interface VectorOptions {
/**
* Attributions.
*/
attributions?: Array<ol.Attribution>;
/**
* Features. If provided as {@link ol.Collection}, the features in the source
* and the collection will stay in sync.
*/
features?: Array<ol.Feature> | ol.Collection<ol.Feature>;
/**
* The feature format used by the XHR feature loader when `url` is set.
* Required if `url` is set, otherwise ignored. Default is `undefined`.
*/
format?: ol.format.Feature;
/**
* The loader function used to load features, from a remote source for example.
* Note that the source will create and use an XHR feature loader when `url` is
* set.
*/
loader?: ol.FeatureLoader;
/**
* Logo.
*/
logo?: string | olx.LogoOptions;
/**
* The loading strategy to use. By default an {@link ol.loadingstrategy.all}
* strategy is used, a one-off strategy which loads all features at once.
*/
strategy?: ol.LoadingStrategy;
/**
* Setting this option instructs the source to use an XHR loader (see
* {@link ol.featureloader.xhr}) and an {@link ol.loadingstrategy.all} for a
* one-off download of all features from that URL.
* Requires `format` to be set as well.
*/
url?: string;
/**
* By default, an RTree is used as spatial index. When features are removed and
* added frequently, and the total number of features is low, setting this to
* `false` may improve performance.
*/
useSpatialIndex?: boolean;
/**
* Wrap the world horizontally. Default is `true`. For vector editing across the
* -180° and 180° meridians to work properly, this should be set to `false`. The
* resulting geometry coordinates will then exceed the world bounds.
*/
wrapX?: boolean;
}
interface WMTSOptions {
attributions?: Array<ol.Attribution>;
crossOrigin?: string;
logo?: string | olx.LogoOptions;
tileGrid: ol.tilegrid.WMTS; // REQUIRED !
projection?: ol.proj.ProjectionLike;
reprojectionErrorThreshold?: number;
requestEncoding?: ol.source.WMTSRequestEncoding;
layer: string; //REQUIRED
style: string; //REQUIRED
tileClass?: Function;
tilePixelRatio?: number;
version?: string;
format?: string;
matrixSet: string; //REQUIRED
dimensions?: Object;
url?: string;
maxZoom?: number;
tileLoadFunction?: ol.TileLoadFunctionType;
urls?: Array<string>;
wrapX: boolean;
}
}
namespace style {
interface FillOptions {
color?: ol.Color | string;
}
interface StyleOptions {
geometry?: string | ol.geom.Geometry | ol.style.GeometryFunction;
fill?: ol.style.Fill;
image?: ol.style.Image;
stroke?: ol.style.Stroke;
text?: ol.style.Text;
zIndex?: number;
}
interface TextOptions {
font?: string;
offsetX?: number;
offsetY?: number;
scale?: number;
rotation?: number;
text?: string;
textAlign?: string;
textBaseline?: string;
fill?: ol.style.Fill;
stroke?: ol.style.Stroke;
}
interface StrokeOptions {
color?: ol.Color | string;
lineCap?: string;
lineJoin?: string;
lineDash?: Array<number>;
miterLimit?: number;
width?: number;
}
interface IconOptions {
anchor?: Array<number>;
anchorOrigin?: string;
anchorXUnits?: string;
anchorYUnits?: string;
crossOrigin?: string;
img?: ol.Image | HTMLCanvasElement;
offset?: Array<number>;
offsetOrigin?: string;
opacity?: number;
scale?: number;
snapToPixel?: boolean;
rotateWithView?: boolean;
rotation?: number;
size?: ol.Size;
imgSize?: ol.Size;
src?: string;
}
interface CircleOptions {
fill?: ol.style.Fill;
radius: number;
snapToPixel?: boolean;
stroke?: ol.style.Stroke;
}
}
namespace tilegrid {
interface TileGridOptions {
/**
* Extent for the tile grid. No tiles outside this extent will be requested by ol.source.Tile sources. When no origin or origins are configured, the origin will be set to the bottom-left corner of the extent. When no sizes are configured, they will be calculated from the extent.
*/
extent?: ol.Extent;
/**
* Minimum zoom. Default is 0.
*/
minZoom?: number;
/**
* Origin, i.e. the bottom-left corner of the grid. Default is null.
*/
origin?: ol.Coordinate;
/**
* Origins, i.e. the bottom-left corners of the grid for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin.
*/
origins?: Array<ol.Coordinate>;
/**
* Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1.
*/
resolutions?: Array<number>;
/**
* Tile size. Default is [256, 256].
*/
tileSize?: number | ol.Size;
/**
* Tile sizes. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different tile size.
*/
tileSizes?: Array<number | ol.Size>;
}
interface WMTSOptions {
/**
* Extent for the tile grid. No tiles outside this extent will be requested by ol.source.WMTS sources. When no origin or origins are configured, the origin will be calculated from the extent. When no sizes are configured, they will be calculated from the extent.
*/
extent?: ol.Extent;
/**
* Origin, i.e. the top-left corner of the grid.
*/
origin?: ol.Coordinate;
/**
* Origins, i.e. the top-left corners of the grid for each zoom level. The length of this array needs to match the length of the resolutions array.
*/
origins?: Array<ol.Coordinate>;
/**
* Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1
*/
resolutions?: Array<number>;
/**
* matrix IDs. The length of this array needs to match the length of the resolutions array.
*/
matrixIds?: Array<string>;
/**
* Number of tile rows and columns of the grid for each zoom level. The values here are the TileMatrixWidth and TileMatrixHeight advertised in the GetCapabilities response of the WMTS, and define the grid's extent together with the origin. An extent can be configured in addition, and will further limit the extent for which tile requests are made by sources.
*/
sizes?: Array<ol.Size>;
/**
* Tile size.
*/
tileSize?: number | ol.Size;
/**
* Tile sizes. The length of this array needs to match the length of the resolutions array.
*/
tileSizes?: Array<number | ol.Size>;
/**
* Number of tile columns that cover the grid's extent for each zoom level. Only required when used with a source that has wrapX set to true, and only when the grid's origin differs from the one of the projection's extent. The array length has to match the length of the resolutions array, i.e. each resolution will have a matching entry here.
*/
widths?: Array<number>;
}
interface XYZOptions {
/**
* Extent for the tile grid. The origin for an XYZ tile grid is the top-left corner of the extent. The zero level of the grid is defined by the resolution at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used.
*/
extent?: ol.Extent;
/**
* Maximum zoom. The default is ol.DEFAULT_MAX_ZOOM. This determines the number of levels in the grid set. For example, a maxZoom of 21 means there are 22 levels in the grid set.
*/
maxZoom?: number;
/**
* Minimum zoom. Default is 0.
*/
minZoom?: number;
/**
* Tile size in pixels. Default is [256, 256].
*/
tileSize?: number | ol.Size;
}
interface ZoomifyOptions {
/**
* Resolutions
*/
resolutions: Array<number>;
}
}
namespace view {