Class: Polygon

.Geo. Polygon


new Polygon(positions [, boundaryBox])

A GeoJSON Polygon object

Parameters:
Name Type Argument Description
positions Array

An array of arrays with at least 2-dimensional arrays of 2-dimensional arrays with the first entry being the longitude and the second one being the latitude.

boundaryBox Array <optional>

An array with [min. longitude, min. latitude, max. longitude, max. latitude]

Example
var polygon = new jsonOdm.Geo.Polygon([
   // The last position should be equal to the first one to close the polygon
   [[51.2,32],[51.4,21],[51.6,21],[51.2,21]],
   // Must be fully inside the n-1th poly-line
   [[51.5,32],[51.6,21],[51.7,21],[51.5,21]]
   // more inner holes might follow
]);

Methods


<static> intersects(polygon, geometry)

Checks whether a Polygon intersects another geometry

Parameters:
Name Type Description
polygon jsonOdm.Geo.Polygon
geometry jsonOdm.Geo.Point | jsonOdm.Geo.BoundaryBox | jsonOdm.Geo.MultiPoint | jsonOdm.Geo.LineString | jsonOdm.Geo.MultiLineString | jsonOdm.Geo.Polygon | jsonOdm.Geo.MultiPolygon | jsonOdm.Geo.GeometryCollection

Any jsonOdm.Geo.<geometry> object

Returns:
Type
boolean

<static> within(polygon, geometry)

Checks whether a Polygon is inside of another geometry

Parameters:
Name Type Description
polygon jsonOdm.Geo.Polygon
geometry jsonOdm.Geo.Point | jsonOdm.Geo.BoundaryBox | jsonOdm.Geo.MultiPoint | jsonOdm.Geo.LineString | jsonOdm.Geo.MultiLineString | jsonOdm.Geo.Polygon | jsonOdm.Geo.MultiPolygon | jsonOdm.Geo.GeometryCollection

Any jsonOdm.Geo.<geometry> object

Returns:
Type
boolean