Geometry creation¶
-
pygeos.creation.
box
(x1, y1, x2, y2)¶ Create box polygons.
- Parameters
- x1array_like
- y1array_like
- x2array_like
- y2array_like
-
pygeos.creation.
destroy_prepared
(geometry, **kwargs)¶ Destroy the prepared part of a geometry, freeing up memory.
Note that the prepared geometry will always be cleaned up if the geometry itself is dereferenced. This function needs only be called in very specific circumstances, such as freeing up memory without losing the geometries, or benchmarking.
- Parameters
- geometryGeometry or array_like
Geometries are changed inplace
See also
-
pygeos.creation.
geometrycollections
(geometries)¶ Create geometrycollections from arrays of geometries
- Parameters
- geometriesarray_like
An array of geometries
-
pygeos.creation.
linearrings
(coords, y=None, z=None)¶ Create an array of linearrings.
If the provided coords do not constitute a closed linestring, the first coordinate is duplicated at the end to close the ring.
- Parameters
- coordsarray_like
An array of lists of coordinate tuples (2- or 3-dimensional) or, if y is provided, an array of lists of x coordinates
- yarray_like
- zarray_like
-
pygeos.creation.
linestrings
(coords, y=None, z=None)¶ Create an array of linestrings.
- Parameters
- coordsarray_like
An array of lists of coordinate tuples (2- or 3-dimensional) or, if y is provided, an array of lists of x coordinates
- yarray_like
- zarray_like
-
pygeos.creation.
multilinestrings
(geometries)¶ Create multilinestrings from arrays of linestrings
- Parameters
- geometriesarray_like
An array of linestrings or coordinates (see linestrings).
-
pygeos.creation.
multipoints
(geometries)¶ Create multipoints from arrays of points
- Parameters
- geometriesarray_like
An array of points or coordinates (see points).
-
pygeos.creation.
multipolygons
(geometries)¶ Create multipolygons from arrays of polygons
- Parameters
- geometriesarray_like
An array of polygons or coordinates (see polygons).
-
pygeos.creation.
points
(coords, y=None, z=None)¶ Create an array of points.
- Parameters
- coordsarray_like
An array of coordinate tuples (2- or 3-dimensional) or, if y is provided, an array of x coordinates.
- yarray_like
- zarray_like
-
pygeos.creation.
polygons
(shells, holes=None)¶ Create an array of polygons.
- Parameters
- shellarray_like
An array of linearrings that constitute the out shell of the polygons. Coordinates can also be passed, see linearrings.
- holesarray_like
An array of lists of linearrings that constitute holes for each shell.
-
pygeos.creation.
prepare
(geometry, **kwargs)¶ Prepare a geometry, improving performance of other operations.
A prepared geometry is a normal geometry with added information such as an index on the line segments. This improves the performance of the following operations: contains, contains_properly, covered_by, covers, crosses, disjoint, intersects, overlaps, touches, and within.
Note that if a prepared geometry is modified, the newly created Geometry object is not prepared. In that case,
prepare
should be called again.This function does not recompute previously prepared geometries; it is efficient to call this function on an array that partially contains prepared geometries.
- Parameters
- geometryGeometry or array_like
Geometries are changed inplace
See also
is_prepared
Identify whether a geometry is prepared already.
destroy_prepared
Destroy the prepared part of a geometry.