You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following up from #369, it would be nice to implement @martinfleis' idea of throwing a warning when the CRS is geographic. Here is where that happens in geopandas.
What we need to decide is where/how this should happen in momepy, and which classes/functions it should happen inside. Maybe a utility function that can be dropped in; something that mimics check_geographic_crs() in GeometryArray:
Python3.10.6|packagedbyconda-forge| (main, Aug222022, 20:43:44) [Clang13.0.1 ]
Type'copyright', 'credits'or'license'formoreinformationIPython8.5.0--AnenhancedInteractivePython. Type'?'forhelp.
In [1]: importgeopandas
...: fromshapely.geometryimportPoint
...: importwarnings
...:
...: defwarn_if_geographic(df):
...: ifdf.crsanddf.crs.is_geographic:
...: warnings.warn(
...: "Geometry is in a geographic CRS. Results are likely "
...: "incorrect. Use 'GeoSeries.to_crs()' to re-project "
...: "geometries to a projected CRS before this operation.",
...: UserWarning
...: )
...:
In [2]: gdf=geopandas.GeoDataFrame(geometry=[Point(0,0)], crs="EPSG:4236")
...: warn_if_geographic(gdf)
<ipython-input-1-c0a117e90671>:7: UserWarning: GeometryisinageographicCRS. Resultsarelikelyincorrect. Use'GeoSeries.to_crs()'tore-projectgeometriestoaprojectedCRSbeforethisoperation.
warnings.warn(
In [3]: gdf=geopandas.GeoDataFrame(geometry=[Point(0,0)], crs="EPSG:3857")
...: warn_if_geographic(gdf)
In [4]: gdf=geopandas.GeoDataFrame(geometry=[Point(0,0)])
...: warn_if_geographic(gdf)
Or possibly using check_geographic_crs() directly?
The text was updated successfully, but these errors were encountered:
Following up from #369, it would be nice to implement @martinfleis' idea of throwing a warning when the CRS is geographic. Here is where that happens in
geopandas
.What we need to decide is where/how this should happen in
momepy
, and which classes/functions it should happen inside. Maybe a utility function that can be dropped in; something that mimicscheck_geographic_crs()
inGeometryArray
:Or possibly using
check_geographic_crs()
directly?The text was updated successfully, but these errors were encountered: