datacube.utils.geometry.Geometry#
- class datacube.utils.geometry.Geometry(geom, crs=None)[source]#
2D Geometry with CRS
Instantiate with a GeoJSON structure
If 3D coordinates are supplied, they are converted to 2D by dropping the Z points.
Methods
__init__
(geom[, crs])buffer
(distance[, resolution])clone
()contains
(other)crosses
(other)difference
(other)disjoint
(other)interpolate
(distance)Returns a point distance units along the line.
intersection
(other)intersects
(other)overlaps
(other)segmented
(resolution)Possibly add more points to the geometry so that no edge is longer than resolution.
simplify
(tolerance[, preserve_topology])split
(splitter)svg
()symmetric_difference
(other)to_crs
(crs[, resolution, wrapdateline])Convert geometry to a different Coordinate Reference System
touches
(other)transform
(func)Applies func to all coordinates of Geometry and returns a new Geometry of the same type and in the same projection from the transformed coordinates.
union
(other)within
(other)Attributes
area
boundary
boundingbox
centroid
convex_hull
coords
envelope
exterior
geom_type
interiors
is_empty
is_valid
json
length
points
wkt
xy
- interpolate(distance)[source]#
Returns a point distance units along the line. Raises TypeError if geometry doesn’t support this operation.
- Return type:
- segmented(resolution)[source]#
Possibly add more points to the geometry so that no edge is longer than resolution.
- Return type:
- to_crs(crs, resolution=None, wrapdateline=False)[source]#
Convert geometry to a different Coordinate Reference System
- Parameters:
resolution (
float
|None
) – Subdivide the geometry such it has no segment longer then the given distance. Defaults to 1 degree for geographic and 100km for projected. To disable completely use Infinity float(‘+inf’)wrapdateline (
bool
) – Attempt to gracefully handle geometry that intersects the dateline when converting to geographic projections. Currently only works in few specific cases (source CRS is smooth over the dateline).
- Return type:
- transform(func)[source]#
Applies func to all coordinates of Geometry and returns a new Geometry of the same type and in the same projection from the transformed coordinates.
func maps x, y, and optionally z to output xp, yp, zp. The input parameters may be iterable types like lists or arrays or single values. The output shall be of the same type: scalars in, scalars out; lists in, lists out.
- Return type: