[英]Simple check for projected crs
我如何輕松檢查 crs 是否是 geopandas 的預測?
基本上是一個 function:
is_projected_crs(crs)
返回 True 或 False。
我需要它,因為我正在編寫一些代碼來避免來自 geopandas 的警告:
Geometry is in a geographic CRS. Results from 'area' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.
crs
帶有一個is_projected
屬性:
import geopandas
gdf = geopandas.read_file(geopandas.datasets.get_path("nybb"))
print(gdf.crs, gdf.crs.is_projected)
# epsg:2263 True
gdf = gdf.to_crs(4326)
print(gdf.crs, gdf.crs.is_projected)
# EPSG:4326 False
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.