spotfiresoftware / spotfire-python

Package for Building Python Extensions to Spotfire®
Other
18 stars 6 forks source link

SBDF read/write doesn't support geopandas 0.7.0+ due to changes in CRS object #12

Closed jorobert closed 3 years ago

jorobert commented 3 years ago

https://community.tibco.com/questions/python-sbdfexportdata-not-compatible-geopandas-070-and-later

When running Spotfire data function:

Could not execute function call 'geopandas_table(2)'

Error executing Python script:

AttributeError: 'CRS' object has no attribute 'startswith'

Traceback (most recent call last):
File "data_function.py", line 358, in _write_outputs
output.write(self.globals, self.debug)
File "data_function.py", line 141, in write
sbdf.export_data(globals_dict[self.name], self.file, default_column_name=self.name)
File "sbdf.py", line 160, in export_data
default_column_name)
File "sbdf.py", line 201, in _export_columnize_data
obj = _geo_data_frame_to_data_frame(obj, table_metadata, column_metadata)
File "sbdf.py", line 1477, in _geo_data_frame_to_data_frame
if gdf.crs.startswith("+init="):

at Spotfire.Dxp.Data.DataFunctions.Executors.LocalPythonFunctionClient.<RunFunction>d__8.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.Executors.PythonScriptExecutor.<ExecuteFunction>d__11.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__8.MoveNext()

As of Geopandas 0.7.0: https://geopandas.org/docs/changelog.html#version-0-7-0-february-16-2020

The important API change of this release is that GeoPandas now requires PROJ > 6 and pyproj > 2.2, and that the .crs attribute of a GeoSeries and GeoDataFrame no longer stores the CRS information as a proj4 string or dict, but as a pyproj.CRS object (#1101).