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])- rtype
clone
()- rtype
contains
(other)- rtype
crosses
(other)- rtype
difference
(other)- rtype
disjoint
(other)- rtype
interpolate
(distance)Returns a point distance units along the line.
intersection
(other)- rtype
intersects
(other)- rtype
overlaps
(other)- rtype
segmented
(resolution)Possibly add more points to the geometry so that no edge is longer than resolution.
simplify
(tolerance[, preserve_topology])- rtype
split
(splitter)svg
()- rtype
symmetric_difference
(other)- rtype
to_crs
(crs[, resolution, wrapdateline])Convert geometry to a different Coordinate Reference System
touches
(other)- rtype
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)- rtype
within
(other)- rtype
Attributes
area
boundary
boundingbox
centroid
convex_hull
coords
envelope
exterior
geom_type
interiors
is_empty
is_valid
json
length
points
wkt
xy
Methods:
interpolate
(distance)Returns a point distance units along the line.
segmented
(resolution)Possibly add more points to the geometry so that no edge is longer than resolution.
split
(splitter)to_crs
(crs[, resolution, wrapdateline])Convert geometry to a different Coordinate Reference System
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.
- 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
crs (
Union
[str
,CRS
,CRS
,Dict
[str
,Any
]]) – CRS to convert toresolution (
Optional
[float
]) – 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