geom.Geometry()

class geom.Geometry()

All geometry subclasses extend from the base Geometry class. The base Geometry constructor is not used, but properties and method documented here are shared by all geometry types.

Common Geometry Properties

Geometry.area

Number The geometry area.

Geometry.bounds

geom.Bounds() The bounds defined by minimum and maximum x and y values in this geometry.

Geometry.centroid

geom.Point The centroid of this geometry.

Geometry.coordinates

Array The geometry’s coordinates array.

Geometry.dimension

Number The dimension of this geometry.

Geometry.empty

Boolean The geometry is empty.

Geometry.json

String The JSON representation of the geometry (see http://geojson.org).

Geometry.length

Number The geometry length.

Geometry.projection

proj.Projection() Optional projection for the geometry. If this is set, it is assumed that the geometry coordinates are in the corresponding coordinate reference system. Use the transform() method to transform a geometry from one coordinate reference system to another.

Geometry.rectangle

Boolean This geometry is a rectangle.

Geometry.simple

Boolean The geometry is simple.

Geometry.valid

Boolean The geometry is valid.

Common Geometry Methods

Geometry.buffer()
Arguments
  • distNumber Width of buffer. May be positive, negative, or zero.

  • optionsObject Options for the buffer operation.

Options:

  • segs Number Integer number of quadrant segments for circular

    arcs. Default is 8.

  • caps Number One of BUFFER_CAP_ROUND,

    BUFFER_CAP_BUTT, or BUFFER_CAP_SQUARE. Default is BUFFER_CAP_ROUND.

  • single Boolean Create a single-sided buffer. Default is

    false.

Returns

geom.Geometry()

Construct a geometry that buffers this geometry by the given width.

Geometry.variableBuffer()
Arguments
  • distancesArray An array of distances.

Returns

geom.Geometry()

Construct a geometry that buffers this geometry with an array of distances.

Geometry.clone()
Returns

geom.Geometry()

Creates a complete copy of this geometry.

Geometry.contains()
Arguments
Returns

Boolean

Tests if this geometry contains the other geometry (without boundaries touching).

Geometry.convexHull()
Returns

geom.Geometry()

Computes the smallest convex geom.Polygon() that contains this geometry.

Geometry.coveredBy()
Arguments
Returns

Boolean

Tests if this geometry is covered by other geometry.

Geometry.covers()
Arguments
Returns

Boolean

Tests if this geometry covers the other geometry.

Geometry.crosses()
Arguments
Returns

Boolean

Tests if this geometry crosses the other geometry.

Geometry.densify()
Arguments
  • toleranceNumber The distance tolerance for the densification. All line segments in the densified geometry will be no longer than the distance tolereance. The tolerance value must be non-negative.

Returns

geom.Geometry()

Densifies a geometry object adding vertices along the line segments of the geometry.

Geometry.difference()
Arguments
Returns

geom.Geometry()

Creates a geometry made up of all the points in this geometry that are not in the other geometry.

Geometry.disjoint()
Arguments
Returns

Boolean

Tests if this geometry is disjoint to the other geometry.

Geometry.distance()
Arguments
Returns

Number

Returns the minimum distance between this and the supplied geometry.

Geometry.equals()
Arguments
Returns

Boolean

Geometries are considered equal if they share at least one point in common and if no point of either geometry lies in the exterior of the other.

Geometry.equalsExact()
Arguments
Returns

Boolean

Tests if this geometry is exactly equal to the other geometry.

Geometry.getBoundary()
Returns

geom.Geometry()

Returns the boundary, or an empty geometry of appropriate dimension if this geometry is empty.

Geometry.getEnvelope()
Returns

geom.Geometry()

Returns this geometry’s bounding box.

Geometry.intersection()
Arguments
Returns

geom.Geometry()

Creates a geometry representing all the points shared by this geometry and the other.

Geometry.intersects()
Arguments
Returns

Boolean

Tests if this geometry intersects the other geometry.

Geometry.overlaps()
Arguments
Returns

Boolean

Tests if this geometry overlaps the other geometry.

Geometry.simplify()
Arguments
  • toleranceNumber The distance tolerance for the simplification. All vertices in the simplified geometry will be within this distance of the original geometry. The tolerance value must be non-negative.

Returns

geom.Geometry()

Simplify the geometry using the standard Douglas-Peucker algorithm. Returns a new geometry.

Geometry.symDifference()
Arguments
Returns

geom.Geometry()

Creates a geometry representing all the points in this geometry but not in the other plus all the points in the other but not in this geometry.

Geometry.touches()
Arguments
Returns

Boolean

Tests if this geometry only touches the other geometry.

Geometry.transform()
Arguments
Returns

geom.Geometry()

Transform coordinates of this geometry to the given projection. The projection of this geometry must be set before calling this method. Returns a new geometry.

Geometry.getMaximumInscribedCircle()
Arguments
  • config – :Object tolerance property defaults to 1.0

Returns

geom.Geometry()

Get the maximum inscribed circle for this Geometry.

Geometry.within()
Arguments
Returns

Boolean

Tests if this geometry is within the other geometry. This is the inverse of contains().

Geometry.getLargestEmptyCircle()
Arguments
  • config – :Object tolerance property defaults to 1.0

Returns

geom.Geometry()

Get the largest empty circle in this Geometry.