ym.modules.provider.Rectangle

Overview

A class for drawing rectangle overlays on a map. Extends Polygon. Use Map.addLayer() uto 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.

Parameters

Name Description Data type Default value
bounds [erforderlich] LatLngBounds  
options [optional] PathOptions  

Methoden

setBounds(bounds) ab v3

Redraws the rectangle with the transferred boundaries.

Parameter

Name Description Data type Default value
bounds   LatLngBounds  

Return

this