| return type | Boolean |
|---|---|
| syntax | $.geo.contains( Object shape1 ( GeoJSON object ), Object shape2 ( GeoJSON object ) ) |
| usage | var contains = $.geo.contains(
{
type: "Polygon", coordinates: [[
[-71.06, 42.3425],
[-71.06, 42.3475],
[-71.04, 42.3475],
[-71.04, 42.3425],
[-71.06, 42.3425]
]]
},
{ type: "Point", "coordinates": [ -71, 40 ] }
) |
The contains method determines if the first basic GeoJSON geometry completely contains a second one. The basic shapes are Point, LineString and Polygon however Point and LineString geometries cannot contain other geometries so the only situation that has a possibility of returning true is when the first argument is a Polygon.
If either argument is not a basic GeoJSON geometry object, this function returns undefined.
This function is similar to Geometry.contains in JTS.