geost.base.Collection.to_crs#
- Collection.to_crs(crs: str | int | CRS, xbot: str | None = None, ybot: str | None = None) None[source]#
Change the horizontal reference (i.e. coordinate reference system, crs) of the collection to the given target crs.
- Parameters:
crs (str | int | CRS) – EPSG of the target crs. Takes anything that can be interpreted by pyproj.crs.CRS.from_user_input().
xbot (str | None, optional) – In case data is inclined, specify labels for columns holding the coordinates of the bottom of each layer. These coordinates will be then transformed as well. The default is None, which means that these coordinates are not transformed.
ybot (str | None, optional) – In case data is inclined, specify labels for columns holding the coordinates of the bottom of each layer. These coordinates will be then transformed as well. The default is None, which means that these coordinates are not transformed.
- Returns:
Updates the header and data of the collection in place.
- Return type:
None
Examples
To change the collection’s current horizontal reference to WGS 84 UTM zone 31N:
>>> collection.to_crs(32631) # Updates object in place.
This would be the same as:
>>> collection.to_crs("epsg:32631")
As Pyproj is very flexible, you can even use the CRS’s full official name:
>>> collection.to_crs("WGS 84 / UTM zone 31N")
In case of inclined layer data, make sure the bottom coordinates of each layer are transformed as well by specifying the column labels for these coordinates:
>>> collection.to_crs(32631, xbot="x_bot", ybot="y_bot")