ym.modules.provider.Rectangle
Overview
A class for drawing rectangle overlays on a map. Extends Polygon. Use Map.addLayer()
to add the rectangle to a map.
Example calls
Define rectangular geographical boundaries:
var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
// Create an orange rectangle.
ym.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
// Zoom the map to the rectangle borders.
map.fitBounds(bounds);
Initialization
Factory: ym.rectangle(bounds, options)
Instantiates a rectangular object with the specified geographical boundaries and optionally with an options object.
Parameter | Description | Data type | Default value |
---|---|---|---|
bounds | [required] | LatLngBounds | |
options | [optional] | PathOptions |
Methods
setBounds(bounds) ab v3
Redraws the rectangle with the transferred boundaries.
Parameter | Description | Data type | Default value |
---|---|---|---|
bounds | LatLngBounds |
- Return: this