Polygon

Draw a polygon on the map.

Parameters

NameDescriptiondefault
pathrequired The coordinates of the polygon, either an array or 2-D/3-D arrays/
maprequired The map instance to which the marker attaches to/
strokeColoroptional The stroke color of the polygon'#3388ff'
strokeOpacityoptional number The opacity of the polygon, in the middle of 0-11.0
strokeWeightoptional number The stroke weight of the polygon3
fillColoroptional string The fill color of the polygon'#3388ff'
fillOpacityoptional number The fill opacity of the polygon0.2
filloptional string Whether to fill the path with colorfalse

Methods

NameDescription
enableEditTo enable editing mode to the shape.

(Not available for Next Billion Maps GL)
removeTo remove the shape from the map

Example

var polygon = new nextbillion.maps.Polygon({
path: loc,
map: map,
color: 'red',
})
// To enable editing mode
// The method "enableEdit" is not available for Next Billion Maps GL
polygon.enableEdit()
// To remove from the map
polygon.remove()