在geopandas sjoin_nearest中distance_col和max_distance的单位是什么?<



geopandas.sjoin_nearest接受max_distancedistance_col参数。距离的单位是什么/我怎么解释?是学位吗?

https://geopandas.org/en/stable/docs/reference/api/geopandas.sjoin_nearest.html geopandas.sjoin_nearest

虽然geoandas提供了坐标系之间转换的实用程序(例如to_crs),但大多数geoandas操作忽略了投影信息。空间操作,如距离、面积、缓冲区等,以几何图形的任何单位完成。如果几何图形的单位是米,这些就是米。如果它们以度为单位,它们就以度为单位。

例如,让我们看一下自然地球数据集。通过查看这些值,您可以看到几何列是经纬度坐标:

In [1]: import geopandas as gpd
In [2]: gdf = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
In [3]: gdf
Out[3]:
pop_est      continent                      name iso_a3  gdp_md_est                                           geometry
0       920938        Oceania                      Fiji    FJI      8374.0  MULTIPOLYGON (((180.00000 -16.06713, 180.00000...
1     53950935         Africa                  Tanzania    TZA    150600.0  POLYGON ((33.90371 -0.95000, 34.07262 -1.05982...
2       603253         Africa                 W. Sahara    ESH       906.5  POLYGON ((-8.66559 27.65643, -8.66512 27.58948...
3     35623680  North America                    Canada    CAN   1674000.0  MULTIPOLYGON (((-122.84000 49.00000, -122.9742...
4    326625791  North America  United States of America    USA  18560000.0  MULTIPOLYGON (((-122.84000 49.00000, -120.0000...
..         ...            ...                       ...    ...         ...                                                ...
172    7111024         Europe                    Serbia    SRB    101800.0  POLYGON ((18.82982 45.90887, 18.82984 45.90888...
173     642550         Europe                Montenegro    MNE     10610.0  POLYGON ((20.07070 42.58863, 19.80161 42.50009...
174    1895250         Europe                    Kosovo    -99     18490.0  POLYGON ((20.59025 41.85541, 20.52295 42.21787...
175    1218208  North America       Trinidad and Tobago    TTO     43570.0  POLYGON ((-61.68000 10.76000, -61.10500 10.890...
176   13026129         Africa                  S. Sudan    SSD     20880.0  POLYGON ((30.83385 3.50917, 29.95350 4.17370, ...
[177 rows x 6 columns]

具体来说,它在WGS84(又名EPSG:4326)中。单位为度:

In [4]: gdf.crs
Out[4]:
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich

如果我们调用area属性,geopandas将发出警告,但它仍然会为我们计算面积。地球的总面积为21497度^2,大约是180*360的1/3:

In [6]: gdf.area.sum()
<ipython-input-6-10238de14784>:1: UserWarning: 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.
gdf.area.sum()
Out[6]: 21496.990987992736

如果我们使用等面积投影,我们将得到更接近地球陆地面积的东西,单位是m^2:

In [10]: gdf.to_crs('+proj=cea').area.sum() / 1e3 / 1e3 / 1e6
Out[10]: 147.36326937311017

最新更新