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 thetransform()
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
dist –
Number
Width of buffer. May be positive, negative, or zero.options –
Object
Options for the buffer operation.
Options:
segs
Number
Integer number of quadrant segments for circulararcs. Default is 8.
caps
Number
One ofBUFFER_CAP_ROUND
,BUFFER_CAP_BUTT
, orBUFFER_CAP_SQUARE
. Default isBUFFER_CAP_ROUND
.
single
Boolean
Create a single-sided buffer. Default isfalse
.
- Returns
Construct a geometry that buffers this geometry by the given width.
-
Geometry.
variableBuffer
()¶ - Arguments
distances –
Array
An array of distances.
- Returns
Construct a geometry that buffers this geometry with an array of distances.
-
Geometry.
clone
()¶ - Returns
Creates a complete copy of this geometry.
-
Geometry.
contains
()¶ - Arguments
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry contains the other geometry (without boundaries touching).
-
Geometry.
convexHull
()¶ - Returns
Computes the smallest convex
geom.Polygon()
that contains this geometry.
-
Geometry.
coveredBy
()¶ - Arguments
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry is covered by other geometry.
-
Geometry.
covers
()¶ - Arguments
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry covers the other geometry.
-
Geometry.
crosses
()¶ - Arguments
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry crosses the other geometry.
-
Geometry.
densify
()¶ - Arguments
tolerance –
Number
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
-
Densifies a geometry object adding vertices along the line segments of the geometry.
-
Geometry.
difference
()¶ - Arguments
other –
geom.Geometry()
- Returns
Creates a geometry made up of all the points in this geometry that are not in the other geometry.
-
Geometry.
disjoint
()¶ - Arguments
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry is disjoint to the other geometry.
-
Geometry.
distance
()¶ - Arguments
geometry –
geom.Geometry()
- Returns
Number
Returns the minimum distance between this and the supplied geometry.
-
Geometry.
equals
()¶ - Arguments
other –
geom.Geometry()
- 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
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry is exactly equal to the other geometry.
-
Geometry.
getBoundary
()¶ - Returns
Returns the boundary, or an empty geometry of appropriate dimension if this geometry is empty.
-
Geometry.
getEnvelope
()¶ - Returns
Returns this geometry’s bounding box.
-
Geometry.
intersection
()¶ - Arguments
other –
geom.Geometry()
- Returns
Creates a geometry representing all the points shared by this geometry and the other.
-
Geometry.
intersects
()¶ - Arguments
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry intersects the other geometry.
-
Geometry.
overlaps
()¶ - Arguments
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry overlaps the other geometry.
-
Geometry.
simplify
()¶ - Arguments
tolerance –
Number
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
Simplify the geometry using the standard Douglas-Peucker algorithm. Returns a new geometry.
-
Geometry.
symDifference
()¶ - Arguments
other –
geom.Geometry()
- Returns
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
other –
geom.Geometry()
- Returns
Boolean
Tests if this geometry only touches the other geometry.
-
Geometry.
transform
()¶ - Arguments
to –
proj.Projection()
- Returns
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
Get the maximum inscribed circle for this Geometry.
-
Geometry.
within
()¶ - Arguments
other –
geom.Geometry()
- 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
Get the largest empty circle in this Geometry.