我正在处理字段地理数据集。我想在地图上显示每个地块时动态计算它们的表面(其原理与此处无关)。
当我能够操作数据集时,我只需执行以下操作:
# I know 3857 is not optimal everywhere but that will do for the example
gdf["surface"] = gdf.to_crs(3857).area
现在我拥有的是以下内容:
feat = gdf[gdf.id == change["new"]].squeeze()
# this is a shaely geometry in 4326 and before computing area,
# I would need to reproject it
surface = feat.geometry