forked from NICEXAI/leaflet_zh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reference-1.3.4.html
23970 lines (20506 loc) · 764 KB
/
reference-1.3.4.html
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
---
layout: v2
title: Documentation
bodyclass: api-page
---
<h2>Leaflet API reference</h2>
<p>This reference reflects <strong>Leaflet 1.3.4</strong>. Check <a href='reference-versions.html'>this list</a> if you are using a different version of Leaflet.</p>
<div id="toc" class="clearfix">
<div class="toc-col map-col">
<h4>Map</h4>
<ul>
<li><a href="#map-example">Usage example</a></li>
<li><a href="#map-factory">Creation</a></li>
<li><a href="#map-option">Options</a></li>
<li><a href="#map-event">Events</a></li>
</ul>
<h4>Map Methods</h4>
<ul>
<li><a href="#map-methods-for-modifying-map-state">Modifying map state</a></li>
<li><a href="#map-methods-for-getting-map-state">Getting map state</a></li>
<li><a href="#map-methods-for-layers-and-controls">Layers and controls</a></li>
<li><a href="#map-conversion-methods">Conversion methods</a></li>
<li><a href="#map-other-methods">Other methods</a></li>
</ul>
<h4>Map Misc</h4>
<ul>
<li><a href="#map-property">Properties</a></li>
<li><a href="#map-pane">Panes</a></li>
</ul>
</div>
<div class="toc-col">
<h4>UI Layers</h4>
<ul>
<li><a href="#marker">Marker</a></li>
<li><a href="#popup">Popup</a></li>
<li><a href="#tooltip">Tooltip</a></li>
</ul>
<h4>Raster Layers</h4>
<ul>
<li><a href="#tilelayer">TileLayer</a></li>
<li><a href="#tilelayer-wms">TileLayer.WMS</a></li>
<li><a href="#imageoverlay">ImageOverlay</a></li>
<li><a href="#videooverlay">VideoOverlay</a></li>
</ul>
<h4>Vector Layers</h4>
<ul>
<li><a href="#path">Path</a></li>
<li><a href="#polyline">Polyline</a></li>
<li><a href="#polygon">Polygon</a></li>
<li><a href="#rectangle">Rectangle</a></li>
<li><a href="#circle">Circle</a></li>
<li><a href="#circlemarker">CircleMarker</a></li>
<li><a href="#svg">SVG</a></li>
<li><a href="#canvas">Canvas</a></li>
</ul>
</div>
<div class="toc-col">
<h4>Other Layers</h4>
<ul>
<li><a href="#layergroup">LayerGroup</a></li>
<li><a href="#featuregroup">FeatureGroup</a></li>
<li><a href="#geojson">GeoJSON</a></li>
<li><a href="#gridlayer">GridLayer</a></li>
</ul>
<h4>Basic Types</h4>
<ul>
<li><a href="#latlng">LatLng</a></li>
<li><a href="#latlngbounds">LatLngBounds</a></li>
<li><a href="#point">Point</a></li>
<li><a href="#bounds">Bounds</a></li>
<li><a href="#icon">Icon</a></li>
<li><a href="#divicon">DivIcon</a></li>
</ul>
<h4>Controls</h4>
<ul>
<li><a href="#control-zoom">Zoom</a></li>
<li><a href="#control-attribution">Attribution</a></li>
<li><a href="#control-layers">Layers</a></li>
<li><a href="#control-scale">Scale</a></li>
</ul>
</div>
<div class="toc-col">
<!-- <h4>Shared Methods</h4> -->
<!-- <ul> -->
<!-- <li><a href="#evented">Event</a></li> -->
<!-- <li><a href="#layers">Layer</a></li> -->
<!-- <li><a href="#popup">Popup</a></li> -->
<!-- </ul> -->
<h4>Utility</h4>
<ul>
<li><a href="#browser">Browser</a></li>
<li><a href="#util">Util</a></li>
<li><a href="#transformation">Transformation</a></li>
<li><a href="#lineutil">LineUtil</a></li>
<li><a href="#polyutil">PolyUtil</a></li>
</ul>
<h4>DOM Utility</h4>
<ul>
<li><a href="#domevent">DomEvent</a></li>
<li><a href="#domutil">DomUtil</a></li>
<li><a href="#posanimation">PosAnimation</a></li>
<li><a href="#draggable">Draggable</a></li>
</ul>
</div>
<div class="toc-col last-col">
<h4>Base Classes</h4>
<ul>
<li><a href="#class">Class</a></li>
<li><a href="#evented">Evented</a></li>
<li><a href="#layer">Layer</a></li>
<li><a href="#interactive-layer">Interactive layer</a></li>
<li><a href="#control">Control</a></li>
<li><a href="#handler">Handler</a></li>
<!--<li><a class="nodocs" href="#">IFeature</a></li>-->
<li><a href="#projection">Projection</a></li>
<li><a href="#crs">CRS</a></li>
<li><a href="#renderer">Renderer</a></li>
</ul>
<h4>Misc</h4>
<ul>
<li><a href="#event-objects">Event objects</a></li>
<li><a href="#global-switches">global switches</a></li>
<li><a href="#noconflict">noConflict</a></li>
<li><a href="#version">version</a></li>
</ul>
</div>
</div>
<h2 id='map'>Map</h2><p>The central class of the API — it is used to create a map on a page and manipulate it.</p>
<section>
<h3 id='map-example'>Usage example</h3>
<section >
<pre><code class="lang-js">// initialize the map on the "map" div with a given center and zoom
var map = L.map('map', {
center: [51.505, -0.09],
zoom: 13
});
</code></pre>
</section>
</section><section>
<h3 id='map-factory'>Creation</h3>
<section >
<table><thead>
<tr>
<th>Factory</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-l-map'>
<td><code><b>L.map</b>(<nobr><String></nobr> <i>id</i>, <nobr><Map options></nobr> <i>options?</i>)</nobr></code></td>
<td>Instantiates a map object given the DOM ID of a <code><div></code> element
and optionally an object literal with <code>Map options</code>.</td>
</tr>
<tr id='map-l-map'>
<td><code><b>L.map</b>(<nobr><HTMLElement></nobr> <i>el</i>, <nobr><Map options></nobr> <i>options?</i>)</nobr></code></td>
<td>Instantiates a map object given an instance of a <code><div></code> HTML element
and optionally an object literal with <code>Map options</code>.</td>
</tr>
</tbody></table>
</section>
</section><section>
<h3 id='map-option'>Options</h3>
<section >
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-prefercanvas'>
<td><code><b>preferCanvas</b></code></td>
<td><code>Boolean</code>
<td><code>false</code></td>
<td>Whether <a href="#path"><code>Path</code></a>s should be rendered on a <a href="#canvas"><code>Canvas</code></a> renderer.
By default, all <code>Path</code>s are rendered in a <a href="#svg"><code>SVG</code></a> renderer.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-control-options'>Control options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-attributioncontrol'>
<td><code><b>attributionControl</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether a <a href="#control-attribution">attribution control</a> is added to the map by default.</td>
</tr>
<tr id='map-zoomcontrol'>
<td><code><b>zoomControl</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether a <a href="#control-zoom">zoom control</a> is added to the map by default.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-interaction-options'>Interaction Options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-closepopuponclick'>
<td><code><b>closePopupOnClick</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Set it to <code>false</code> if you don't want popups to close when user clicks the map.</td>
</tr>
<tr id='map-boxzoom'>
<td><code><b>boxZoom</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether the map can be zoomed to a rectangular area specified by
dragging the mouse while pressing the shift key.</td>
</tr>
<tr id='map-doubleclickzoom'>
<td><code><b>doubleClickZoom</b></code></td>
<td><code>Boolean|String</code>
<td><code>true</code></td>
<td>Whether the map can be zoomed in by double clicking on it and
zoomed out by double clicking while holding shift. If passed
<code>'center'</code>, double-click zoom will zoom to the center of the
view regardless of where the mouse was.</td>
</tr>
<tr id='map-dragging'>
<td><code><b>dragging</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether the map be draggable with mouse/touch or not.</td>
</tr>
<tr id='map-zoomsnap'>
<td><code><b>zoomSnap</b></code></td>
<td><code>Number</code>
<td><code>1</code></td>
<td>Forces the map's zoom level to always be a multiple of this, particularly
right after a <a href="#map-fitbounds"><code>fitBounds()</code></a> or a pinch-zoom.
By default, the zoom level snaps to the nearest integer; lower values
(e.g. <code>0.5</code> or <code>0.1</code>) allow for greater granularity. A value of <code>0</code>
means the zoom level will not be snapped after <code>fitBounds</code> or a pinch-zoom.</td>
</tr>
<tr id='map-zoomdelta'>
<td><code><b>zoomDelta</b></code></td>
<td><code>Number</code>
<td><code>1</code></td>
<td>Controls how much the map's zoom level will change after a
<a href="#map-zoomin"><code>zoomIn()</code></a>, <a href="#map-zoomout"><code>zoomOut()</code></a>, pressing <code>+</code>
or <code>-</code> on the keyboard, or using the <a href="#control-zoom">zoom controls</a>.
Values smaller than <code>1</code> (e.g. <code>0.5</code>) allow for greater granularity.</td>
</tr>
<tr id='map-trackresize'>
<td><code><b>trackResize</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether the map automatically handles browser window resize to update itself.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-panning-inertia-options'>Panning Inertia Options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-inertia'>
<td><code><b>inertia</b></code></td>
<td><code>Boolean</code>
<td><code>*</code></td>
<td>If enabled, panning of the map will have an inertia effect where
the map builds momentum while dragging and continues moving in
the same direction for some time. Feels especially nice on touch
devices. Enabled by default unless running on old Android devices.</td>
</tr>
<tr id='map-inertiadeceleration'>
<td><code><b>inertiaDeceleration</b></code></td>
<td><code>Number</code>
<td><code>3000</code></td>
<td>The rate with which the inertial movement slows down, in pixels/second².</td>
</tr>
<tr id='map-inertiamaxspeed'>
<td><code><b>inertiaMaxSpeed</b></code></td>
<td><code>Number</code>
<td><code>Infinity</code></td>
<td>Max speed of the inertial movement, in pixels/second.</td>
</tr>
<tr id='map-easelinearity'>
<td><code><b>easeLinearity</b></code></td>
<td><code>Number</code>
<td><code>0.2</code></td>
<td></td>
</tr>
<tr id='map-worldcopyjump'>
<td><code><b>worldCopyJump</b></code></td>
<td><code>Boolean</code>
<td><code>false</code></td>
<td>With this option enabled, the map tracks when you pan to another "copy"
of the world and seamlessly jumps to the original one so that all overlays
like markers and vector layers are still visible.</td>
</tr>
<tr id='map-maxboundsviscosity'>
<td><code><b>maxBoundsViscosity</b></code></td>
<td><code>Number</code>
<td><code>0.0</code></td>
<td>If <code>maxBounds</code> is set, this option will control how solid the bounds
are when dragging the map around. The default value of <code>0.0</code> allows the
user to drag outside the bounds at normal speed, higher values will
slow down map dragging outside bounds, and <code>1.0</code> makes the bounds fully
solid, preventing the user from dragging outside the bounds.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-keyboard-navigation-options'>Keyboard Navigation Options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-keyboard'>
<td><code><b>keyboard</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Makes the map focusable and allows users to navigate the map with keyboard
arrows and <code>+</code>/<code>-</code> keys.</td>
</tr>
<tr id='map-keyboardpandelta'>
<td><code><b>keyboardPanDelta</b></code></td>
<td><code>Number</code>
<td><code>80</code></td>
<td>Amount of pixels to pan when pressing an arrow key.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-mousewheel-options'>Mousewheel options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-scrollwheelzoom'>
<td><code><b>scrollWheelZoom</b></code></td>
<td><code>Boolean|String</code>
<td><code>true</code></td>
<td>Whether the map can be zoomed by using the mouse wheel. If passed <code>'center'</code>,
it will zoom to the center of the view regardless of where the mouse was.</td>
</tr>
<tr id='map-wheeldebouncetime'>
<td><code><b>wheelDebounceTime</b></code></td>
<td><code>Number</code>
<td><code>40</code></td>
<td>Limits the rate at which a wheel can fire (in milliseconds). By default
user can't zoom via wheel more often than once per 40 ms.</td>
</tr>
<tr id='map-wheelpxperzoomlevel'>
<td><code><b>wheelPxPerZoomLevel</b></code></td>
<td><code>Number</code>
<td><code>60</code></td>
<td>How many scroll pixels (as reported by <a href="#domevent-getwheeldelta">L.DomEvent.getWheelDelta</a>)
mean a change of one full zoom level. Smaller values will make wheel-zooming
faster (and vice versa).</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-touch-interaction-options'>Touch interaction options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-tap'>
<td><code><b>tap</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Enables mobile hacks for supporting instant taps (fixing 200ms click
delay on iOS/Android) and touch holds (fired as <code>contextmenu</code> events).</td>
</tr>
<tr id='map-taptolerance'>
<td><code><b>tapTolerance</b></code></td>
<td><code>Number</code>
<td><code>15</code></td>
<td>The max number of pixels a user can shift his finger during touch
for it to be considered a valid tap.</td>
</tr>
<tr id='map-touchzoom'>
<td><code><b>touchZoom</b></code></td>
<td><code>Boolean|String</code>
<td><code>*</code></td>
<td>Whether the map can be zoomed by touch-dragging with two fingers. If
passed <code>'center'</code>, it will zoom to the center of the view regardless of
where the touch events (fingers) were. Enabled for touch-capable web
browsers except for old Androids.</td>
</tr>
<tr id='map-bounceatzoomlimits'>
<td><code><b>bounceAtZoomLimits</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Set it to false if you don't want the map to zoom beyond min/max zoom
and then bounce back when pinch-zooming.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-map-state-options'>Map State Options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-crs'>
<td><code><b>crs</b></code></td>
<td><code><a href='#crs'>CRS</a></code>
<td><code>L.CRS.EPSG3857</code></td>
<td>The <a href="#crs">Coordinate Reference System</a> to use. Don't change this if you're not
sure what it means.</td>
</tr>
<tr id='map-center'>
<td><code><b>center</b></code></td>
<td><code><a href='#latlng'>LatLng</a></code>
<td><code>undefined</code></td>
<td>Initial geographic center of the map</td>
</tr>
<tr id='map-zoom'>
<td><code><b>zoom</b></code></td>
<td><code>Number</code>
<td><code>undefined</code></td>
<td>Initial map zoom level</td>
</tr>
<tr id='map-minzoom'>
<td><code><b>minZoom</b></code></td>
<td><code>Number</code>
<td><code>*</code></td>
<td>Minimum zoom level of the map.
If not specified and at least one <a href="#gridlayer"><code>GridLayer</code></a> or <a href="#tilelayer"><code>TileLayer</code></a> is in the map,
the lowest of their <code>minZoom</code> options will be used instead.</td>
</tr>
<tr id='map-maxzoom'>
<td><code><b>maxZoom</b></code></td>
<td><code>Number</code>
<td><code>*</code></td>
<td>Maximum zoom level of the map.
If not specified and at least one <a href="#gridlayer"><code>GridLayer</code></a> or <a href="#tilelayer"><code>TileLayer</code></a> is in the map,
the highest of their <code>maxZoom</code> options will be used instead.</td>
</tr>
<tr id='map-layers'>
<td><code><b>layers</b></code></td>
<td><code>Layer[]</code>
<td><code>[]</code></td>
<td>Array of layers that will be added to the map initially</td>
</tr>
<tr id='map-maxbounds'>
<td><code><b>maxBounds</b></code></td>
<td><code><a href='#latlngbounds'>LatLngBounds</a></code>
<td><code>null</code></td>
<td>When this option is set, the map restricts the view to the given
geographical bounds, bouncing the user back if the user tries to pan
outside the view. To set the restriction dynamically, use
<a href="#map-setmaxbounds"><code>setMaxBounds</code></a> method.</td>
</tr>
<tr id='map-renderer'>
<td><code><b>renderer</b></code></td>
<td><code><a href='#renderer'>Renderer</a></code>
<td><code>*</code></td>
<td>The default method for drawing vector layers on the map. <a href="#svg"><code>L.SVG</code></a>
or <a href="#canvas"><code>L.Canvas</code></a> by default depending on browser support.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-animation-options'>Animation Options</h4>
<table><thead>
<tr>
<th>Option</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-zoomanimation'>
<td><code><b>zoomAnimation</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether the map zoom animation is enabled. By default it's enabled
in all browsers that support CSS3 Transitions except Android.</td>
</tr>
<tr id='map-zoomanimationthreshold'>
<td><code><b>zoomAnimationThreshold</b></code></td>
<td><code>Number</code>
<td><code>4</code></td>
<td>Won't animate zoom if the zoom difference exceeds this value.</td>
</tr>
<tr id='map-fadeanimation'>
<td><code><b>fadeAnimation</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether the tile fade animation is enabled. By default it's enabled
in all browsers that support CSS3 Transitions except Android.</td>
</tr>
<tr id='map-markerzoomanimation'>
<td><code><b>markerZoomAnimation</b></code></td>
<td><code>Boolean</code>
<td><code>true</code></td>
<td>Whether markers animate their zoom with the zoom animation, if disabled
they will disappear for the length of the animation. By default it's
enabled in all browsers that support CSS3 Transitions except Android.</td>
</tr>
<tr id='map-transform3dlimit'>
<td><code><b>transform3DLimit</b></code></td>
<td><code>Number</code>
<td><code>2^23</code></td>
<td>Defines the maximum size of a CSS translation transform. The default
value should not be changed unless a web browser positions layers in
the wrong place after doing a large <code>panBy</code>.</td>
</tr>
</tbody></table>
</section>
</section><section>
<h3 id='map-event'>Events</h3>
<section class='collapsable'>
<h4 id='map-layer-events'>Layer events</h4>
<table><thead>
<tr>
<th>Event</th>
<th>Data</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-baselayerchange'>
<td><code><b>baselayerchange</b>
<td><code><a href='#layerscontrolevent'>LayersControlEvent</a></code></td>
<td>Fired when the base layer is changed through the <a href="#control-layers">layer control</a>.</td>
</tr>
<tr id='map-overlayadd'>
<td><code><b>overlayadd</b>
<td><code><a href='#layerscontrolevent'>LayersControlEvent</a></code></td>
<td>Fired when an overlay is selected through the <a href="#control-layers">layer control</a>.</td>
</tr>
<tr id='map-overlayremove'>
<td><code><b>overlayremove</b>
<td><code><a href='#layerscontrolevent'>LayersControlEvent</a></code></td>
<td>Fired when an overlay is deselected through the <a href="#control-layers">layer control</a>.</td>
</tr>
<tr id='map-layeradd'>
<td><code><b>layeradd</b>
<td><code><a href='#layerevent'>LayerEvent</a></code></td>
<td>Fired when a new layer is added to the map.</td>
</tr>
<tr id='map-layerremove'>
<td><code><b>layerremove</b>
<td><code><a href='#layerevent'>LayerEvent</a></code></td>
<td>Fired when some layer is removed from the map</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-map-state-change-events'>Map state change events</h4>
<div class='section-comments'></div>
<table><thead>
<tr>
<th>Event</th>
<th>Data</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-zoomlevelschange'>
<td><code><b>zoomlevelschange</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the number of zoomlevels on the map is changed due
to adding or removing a layer.</td>
</tr>
<tr id='map-resize'>
<td><code><b>resize</b>
<td><code><a href='#resizeevent'>ResizeEvent</a></code></td>
<td>Fired when the map is resized.</td>
</tr>
<tr id='map-unload'>
<td><code><b>unload</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the map is destroyed with <a href="#map-remove">remove</a> method.</td>
</tr>
<tr id='map-viewreset'>
<td><code><b>viewreset</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the map needs to redraw its content (this usually happens
on map zoom or load). Very useful for creating custom overlays.</td>
</tr>
<tr id='map-load'>
<td><code><b>load</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the map is initialized (when its center and zoom are set
for the first time).</td>
</tr>
<tr id='map-zoomstart'>
<td><code><b>zoomstart</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the map zoom is about to change (e.g. before zoom animation).</td>
</tr>
<tr id='map-movestart'>
<td><code><b>movestart</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the view of the map starts changing (e.g. user starts dragging the map).</td>
</tr>
<tr id='map-zoom'>
<td><code><b>zoom</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired repeatedly during any change in zoom level, including zoom
and fly animations.</td>
</tr>
<tr id='map-move'>
<td><code><b>move</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired repeatedly during any movement of the map, including pan and
fly animations.</td>
</tr>
<tr id='map-zoomend'>
<td><code><b>zoomend</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the map has changed, after any animations.</td>
</tr>
<tr id='map-moveend'>
<td><code><b>moveend</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the center of the map stops changing (e.g. user stopped
dragging the map).</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-popup-events'>Popup events</h4>
<table><thead>
<tr>
<th>Event</th>
<th>Data</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-popupopen'>
<td><code><b>popupopen</b>
<td><code><a href='#popupevent'>PopupEvent</a></code></td>
<td>Fired when a popup is opened in the map</td>
</tr>
<tr id='map-popupclose'>
<td><code><b>popupclose</b>
<td><code><a href='#popupevent'>PopupEvent</a></code></td>
<td>Fired when a popup in the map is closed</td>
</tr>
<tr id='map-autopanstart'>
<td><code><b>autopanstart</b>
<td><code><a href='#event'>Event</a></code></td>
<td>Fired when the map starts autopanning when opening a popup.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-tooltip-events'>Tooltip events</h4>
<table><thead>
<tr>
<th>Event</th>
<th>Data</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-tooltipopen'>
<td><code><b>tooltipopen</b>
<td><code><a href='#tooltipevent'>TooltipEvent</a></code></td>
<td>Fired when a tooltip is opened in the map.</td>
</tr>
<tr id='map-tooltipclose'>
<td><code><b>tooltipclose</b>
<td><code><a href='#tooltipevent'>TooltipEvent</a></code></td>
<td>Fired when a tooltip in the map is closed.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-location-events'>Location events</h4>
<table><thead>
<tr>
<th>Event</th>
<th>Data</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-locationerror'>
<td><code><b>locationerror</b>
<td><code><a href='#errorevent'>ErrorEvent</a></code></td>
<td>Fired when geolocation (using the <a href="#map-locate"><code>locate</code></a> method) failed.</td>
</tr>
<tr id='map-locationfound'>
<td><code><b>locationfound</b>
<td><code><a href='#locationevent'>LocationEvent</a></code></td>
<td>Fired when geolocation (using the <a href="#map-locate"><code>locate</code></a> method)
went successfully.</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-interaction-events'>Interaction events</h4>
<table><thead>
<tr>
<th>Event</th>
<th>Data</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-click'>
<td><code><b>click</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired when the user clicks (or taps) the map.</td>
</tr>
<tr id='map-dblclick'>
<td><code><b>dblclick</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired when the user double-clicks (or double-taps) the map.</td>
</tr>
<tr id='map-mousedown'>
<td><code><b>mousedown</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired when the user pushes the mouse button on the map.</td>
</tr>
<tr id='map-mouseup'>
<td><code><b>mouseup</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired when the user releases the mouse button on the map.</td>
</tr>
<tr id='map-mouseover'>
<td><code><b>mouseover</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired when the mouse enters the map.</td>
</tr>
<tr id='map-mouseout'>
<td><code><b>mouseout</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired when the mouse leaves the map.</td>
</tr>
<tr id='map-mousemove'>
<td><code><b>mousemove</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired while the mouse moves over the map.</td>
</tr>
<tr id='map-contextmenu'>
<td><code><b>contextmenu</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired when the user pushes the right mouse button on the map, prevents
default browser context menu from showing if there are listeners on
this event. Also fired on mobile when the user holds a single touch
for a second (also called long press).</td>
</tr>
<tr id='map-keypress'>
<td><code><b>keypress</b>
<td><code><a href='#keyboardevent'>KeyboardEvent</a></code></td>
<td>Fired when the user presses a key from the keyboard while the map is focused.</td>
</tr>
<tr id='map-preclick'>
<td><code><b>preclick</b>
<td><code><a href='#mouseevent'>MouseEvent</a></code></td>
<td>Fired before mouse click on the map (sometimes useful when you
want something to happen on click before any existing click
handlers start running).</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-other-methods'>Other Methods</h4>
<table><thead>
<tr>
<th>Event</th>
<th>Data</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-zoomanim'>
<td><code><b>zoomanim</b>
<td><code><a href='#zoomanimevent'>ZoomAnimEvent</a></code></td>
<td>Fired on every frame of a zoom animation</td>
</tr>
</tbody></table>
</section>
</section><section>
<h3 id='map-method'>Methods</h3>
<section >
<table><thead>
<tr>
<th>Method</th>
<th>Returns</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-getrenderer'>
<td><code><b>getRenderer</b>(<nobr><<a href='#path'>Path</a>></nobr> <i>layer</i>)</nobr></code></td>
<td><code><a href='#renderer'>Renderer</a></code></td>
<td><p>Returns the instance of <a href="#renderer"><code>Renderer</code></a> that should be used to render the given
<a href="#path"><code>Path</code></a>. It will ensure that the <a href="#renderer"><code>renderer</code></a> options of the map and paths
are respected, and that the renderers do exist on the map.</p>
</td>
</tr>
</tbody></table>
</section><section class='collapsable'>
<h4 id='map-methods-for-layers-and-controls'>Methods for Layers and Controls</h4>
<div class='section-comments'></div>
<table><thead>
<tr>
<th>Method</th>
<th>Returns</th>
<th>Description</th>
</tr>
</thead><tbody>
<tr id='map-addcontrol'>
<td><code><b>addControl</b>(<nobr><<a href='#control'>Control</a>></nobr> <i>control</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Adds the given control to the map</p>
</td>
</tr>
<tr id='map-removecontrol'>
<td><code><b>removeControl</b>(<nobr><<a href='#control'>Control</a>></nobr> <i>control</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Removes the given control from the map</p>
</td>
</tr>
<tr id='map-addlayer'>
<td><code><b>addLayer</b>(<nobr><<a href='#layer'>Layer</a>></nobr> <i>layer</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Adds the given layer to the map</p>
</td>
</tr>
<tr id='map-removelayer'>
<td><code><b>removeLayer</b>(<nobr><<a href='#layer'>Layer</a>></nobr> <i>layer</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Removes the given layer from the map.</p>
</td>
</tr>
<tr id='map-haslayer'>
<td><code><b>hasLayer</b>(<nobr><<a href='#layer'>Layer</a>></nobr> <i>layer</i>)</nobr></code></td>
<td><code>Boolean</code></td>
<td><p>Returns <code>true</code> if the given layer is currently added to the map</p>
</td>
</tr>
<tr id='map-eachlayer'>
<td><code><b>eachLayer</b>(<nobr><Function></nobr> <i>fn</i>, <nobr><Object></nobr> <i>context?</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Iterates over the layers of the map, optionally specifying context of the iterator function.</p>
<pre><code>map.eachLayer(function(layer){
layer.bindPopup('Hello');
});
</code></pre></td>
</tr>
<tr id='map-openpopup'>
<td><code><b>openPopup</b>(<nobr><<a href='#popup'>Popup</a>></nobr> <i>popup</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).</p>
</td>
</tr>
<tr id='map-openpopup'>
<td><code><b>openPopup</b>(<nobr><String|HTMLElement></nobr> <i>content</i>, <nobr><<a href='#latlng'>LatLng</a>></nobr> <i>latlng</i>, <nobr><<a href='#popup-option'>Popup options</a>></nobr> <i>options?</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Creates a popup with the specified content and options and opens it in the given point on a map.</p>
</td>
</tr>
<tr id='map-closepopup'>
<td><code><b>closePopup</b>(<nobr><<a href='#popup'>Popup</a>></nobr> <i>popup?</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Closes the popup previously opened with <a href="#map-openpopup">openPopup</a> (or the given one).</p>
</td>
</tr>
<tr id='map-opentooltip'>
<td><code><b>openTooltip</b>(<nobr><<a href='#tooltip'>Tooltip</a>></nobr> <i>tooltip</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Opens the specified tooltip.</p>
</td>
</tr>
<tr id='map-opentooltip'>
<td><code><b>openTooltip</b>(<nobr><String|HTMLElement></nobr> <i>content</i>, <nobr><<a href='#latlng'>LatLng</a>></nobr> <i>latlng</i>, <nobr><<a href='#tooltip-option'>Tooltip options</a>></nobr> <i>options?</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Creates a tooltip with the specified content and options and open it.</p>
</td>
</tr>
<tr id='map-closetooltip'>
<td><code><b>closeTooltip</b>(<nobr><<a href='#tooltip'>Tooltip</a>></nobr> <i>tooltip?</i>)</nobr></code></td>
<td><code>this</code></td>
<td><p>Closes the tooltip given as parameter.</p>
</td>
</tr>