ym.modules.provider.Polygon

Overview

The returnA class for drawing polygon overlays on a map (extends Polyline). Use Map.addLayer to add a polygon to the map.
Note that to close the polygon, the last point must not be identical to the first. The polygon is automatically closed. e is of the type GeoJson (see geojson.org).

Initialization

Factory: ym.polygon(latlngs, options)

Instantiates a polygon object with an array of geographic points and optionally an option object (like polyline). You can also create a polygon with holes by passing an array of latlngs, where the first latlngs array represents the outer ring while the others represent the holes inside.

Parameters

Name Description Data types Default value
latlngs [required] LatLng[]  
options [optional] PolylineOptions  

Methods

Polygon has the same options and methods as Polyline, except that toGeoJSON() returns a polygon in the form of a JSON object instead of a polyline.