geopandas.sjoin_nearest takes parameters max_distance and distance_col. What is the units of the distances / how do I interpret them? Is it degrees?
https://geopandas.org/en/stable/docs/reference/api/geopandas.sjoin_nearest.html#geopandas.sjoin_nearest
While geopandas provides utilities for converting between coordinate systems (e.g. to_crs), most operations in geopandas ignore the projection information. Spatial operations such as distance, area, buffer, etc. are done in whatever units the geometries are in. If your geometries are in meters, these will be in meters. If they're in degrees, they'll be in degrees.
For example, let's take a look at the natural earth dataset. You can see that the geometry column is in lat/lon coordinates by just looking at the values:
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]
Specifically, it's in WGS84 (aka EPSG:4326). The units are degrees:
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
If we call the area property, geopandas will issue a warning, but it will still calculate the area for us. The total area of the earth comes out to 21,497 degrees^2, which roughly 1/3 of 180*360:
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
If we instead use an equal area projection, we'll get something much closer to the land area of the earth, in m^2:
In [10]: gdf.to_crs('+proj=cea').area.sum() / 1e3 / 1e3 / 1e6
Out[10]: 147.36326937311017
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With