File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed
Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
2222### Fixed
2323
24+ - ` CsvJobDatabase ` : workaround GeoPandas issue when there is a column named "crs" ([ #714 ] ( https://github.com/Open-EO/openeo-python-client/issues/714 ) )
25+
2426
2527## [ 0.37.0] - 2025-01-21 - "SAP10" release
2628
Original file line number Diff line number Diff line change @@ -904,7 +904,8 @@ def read(self) -> pd.DataFrame:
904904 import geopandas
905905
906906 # `df.to_csv()` in `persist()` has encoded geometries as WKT, so we decode that here.
907- df = geopandas .GeoDataFrame (df , geometry = geopandas .GeoSeries .from_wkt (df ["geometry" ]))
907+ df .geometry = geopandas .GeoSeries .from_wkt (df ["geometry" ])
908+ df = geopandas .GeoDataFrame (df )
908909 return df
909910
910911 def persist (self , df : pd .DataFrame ):
Original file line number Diff line number Diff line change 2525 "urllib3<2.3.0" , # httpretty doesn't work properly with urllib3>=2.3.0. See #700 and https://github.com/gabrielfalcao/HTTPretty/issues/484
2626 "netCDF4>=1.7.0" ,
2727 "matplotlib" , # TODO: eliminate matplotlib as test dependency
28- "geopandas" ,
28+ "geopandas>0.13.2 " ,
2929 "flake8>=5.0.0" ,
3030 "time_machine" ,
3131 "pyproj>=3.2.0" , # Pyproj is an optional, best-effort runtime dependency
Original file line number Diff line number Diff line change @@ -977,6 +977,26 @@ def test_initialize_from_df_on_exists_skip(self, tmp_path):
977977 )
978978 assert set (db .read ()["some_number" ]) == {1 , 2 , 3 }
979979
980+ def test_read_with_crs_column (self , tmp_path ):
981+ """
982+ Having a column named "crs" can cause obscure error messages when creating a GeoPandas dataframe
983+ https://github.com/Open-EO/openeo-python-client/issues/714
984+ """
985+ source_df = pd .DataFrame (
986+ {
987+ "crs" : [1234 ],
988+ "geometry" : ["Point(2 3)" ],
989+ }
990+ )
991+ path = tmp_path / "jobs.csv"
992+ source_df .to_csv (path , index = False )
993+ result_df = CsvJobDatabase (path ).read ()
994+ assert isinstance (result_df , geopandas .GeoDataFrame )
995+ assert result_df .to_dict (orient = "list" ) == {
996+ "crs" : [1234 ],
997+ "geometry" : [shapely .geometry .Point (2 , 3 )],
998+ }
999+
9801000
9811001class TestParquetJobDatabase :
9821002
You can’t perform that action at this time.
0 commit comments