diff --git a/reference.html b/reference.html index 42fbb0898fc..84785463376 100644 --- a/reference.html +++ b/reference.html @@ -44,9 +44,7 @@
L.CRS.
EPSG3857
renderer
Renderer
depends
L.SVG
or L.Canvas
by default depending on browser support.this
getRenderer(
+ <ILayer> layer)
+
Renderer
color
String
'#03f'
'#3388ff'
weight
Number
5
3
opacity
Number
0.5
1
lineCap
String
null
'round'
lineJoin
String
null
'round'
true
false
, the vector will not emit mouse events and will act as a part of the underlying map.renderer
Renderer
depends
L.SVG
or L.Canvas
by default depending on browser support.pointerEvents
String
null
pointer-events
attribute on the path if SVG backend is used.pointer-events
attribute on the path if SVG renderer is used.className
// create a red polyline from an arrays of LatLng points
+var latlngs = [
+ [-122.68, 45.51],
+ [-122.43, 37.77],
+ [-118.2, 34.04]
+];
+
var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
// zoom the map to the polyline
map.fitBounds(polyline.getBounds());
+You can also pass a multi-dimensional array to represent a MultiPolyline
shape:
// create a red polyline from an array of arrays of LatLng points
+var latlngs = [
+ [[-122.68, 45.51],
+ [-122.43, 37.77],
+ [-118.2, 34.04]],
+ [[-73.91, 40.78],
+ [-87.62, 41.83],
+ [-96.72, 32.76]]
+];
+
Instantiates a polyline object given an array of geographical points and optionally an options object. | +Instantiates a polyline object given an array of geographical points and optionally an options object. You can create a Polyline object with multiple separate lines (MultiPolyline ) by passing an array of arrays of geographic points. |
LatLngBounds
getCenter()
LatLng
toGeoJSON()
Object
Extends FeatureGroup to allow creating multi-polylines (single layer that consists of several polylines that share styling/popup).
- -Factory | - -Description | -
---|---|
L.multiPolyline(
- |
-
-
-
- Instantiates a multi-polyline object given an array of arrays of geographical points (one for each individual polyline) and optionally an options object. | -
MultiPolylines accept all Polyline methods but -have different behavior around their coordinate contents since they can contain -multiple line features:
+A class for drawing polygon overlays on a map. Extends Polyline. Use Map#addLayer to add it to the map.
-Method | -Returns | -Description | -
---|---|---|
setLatLngs(
- |
+this |
- Replace all lines and their paths with the given array of arrays of - geographical points. | -
getLatLngs() |
+
|
- Returns an array of arrays of geographical points in each line. | -
openPopup() |
+var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
- this |
- Opens the popup previously bound by bindPopup. | -
toGeoJSON() |
- Object |
- Returns a GeoJSON representation of the multipolyline (GeoJSON MultiLineString Feature). | -
You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
+
+var latlngs = [
+ [[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
+ [[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
+];
-Additionally, you can pass a multi-dimensional array to represent a MultiPolygon
shape.
A class for drawing polygon overlays on a map. Extends Polyline. Use Map#addLayer to add it to the map.
+
+var latlngs = [
+ [ // first polygon
+ [[-111.03, 41],[-111.04, 45],[-104.05, 45],[-104.05, 41]], // outer ring
+ [[-108.58,37.29],[-108.58,40.71],[-102.50,40.71],[-102.50,37.29]] // hole
+ ],
+ [ // second polygon
+ [[-109.05, 37],[-109.03, 41],[-102.05, 41],[-102.04, 37],[-109.05, 38]]
+ ]
+];
-Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
Polygon
with multiple separate shapes (MultiPolygon
) by passing an array of Polygon
coordinates.Extends FeatureGroup to allow creating multi-polygons (single layer that consists of several polygons that share styling/popup).
- -Factory | - -Description | -
---|---|
L.multiPolygon(
- |
-
-
- Instantiates a multi-polygon object given an array of latlngs arrays (one for each individual polygon) and optionally an options object (the same as for MultiPolyline). | -
MultiPolygons accept all Polyline methods but -have different behavior around their coordinate contents since they can contain -multiple polygon features:
- -Method | -Returns | -Description | -
---|---|---|
setLatLngs(
- |
-
- this |
- Replace all polygons and their paths with the given array of arrays of - geographical points. | -
getLatLngs() |
-
-
|
- Returns an array of arrays of geographical points in each polygon. | -
openPopup() |
-
- this |
- Opens the popup previously bound by bindPopup. | -
toGeoJSON() |
- Object |
- Returns a GeoJSON representation of the multipolygon (GeoJSON MultiPolygon Feature). | -
A class for drawing circle overlays on a map. Extends Path. Use Map#addLayer to add it to the map.
+A class for drawing circle overlays on a map. Extends CircleMarker. Use Map#addLayer to add it to the map.
L.circle([50.5, 30.5], 200).addTo(map);
@@ -2991,7 +2930,7 @@ A circle of a fixed size with radius specified in pixels. Extends Circle. Use Map#addLayer to add it to the map.
+A circle of a fixed size with radius specified in pixels. Extends Path. Use Map#addLayer to add it to the map.