utm_crs

Contents

utm_crs#

utm_crs(gdf: GeoDataFrame) None[source]#

Change temporary the CRS of a vector, ie when computing area based statistics / features (centroid….) which need a meter-based CRS.

Warning

The modifications (other than CRS) on the yielded GeoDataFrame will be kept!

Parameters:

gdf (str) – GeoDataFrame to convert

Example

>>> vect = vectors.read(vectors_path().joinpath("aoi.kml"))
>>> with vectors.utm_crs(vect) as utm_vect:
>>>     utm_centroid = utm_vect.centroid
>>>     utm_vect["centroid_utm"] = utm_centroid
>>> vect["centroid_utm"].equals(c2)
True