trackintel icon indicating copy to clipboard operation
trackintel copied to clipboard

Cannot rename geometry column with postgis IO functions

Open henrymartin1 opened this issue 2 years ago • 0 comments

We are still on the hunt for the postgis integration that allows to read any data directly into a trackintel class using only one line of code ;-)

We are very close but I noticed another problem. I have a database with staypoints that have a geometry column named geometry_raw which I want to rename to geom. The challange is that this involves three steps:

  • Reading a geopandas dataframe with the geometry column geometry_raw from the database
  • Renaming the geometry column to geom
  • Setting the geometry column to geom

Renaming is now supported by using the passing the mapping argument down to read_staypoints_gpd However, I cannot pass the geom_col argument as **kwds to read_staypoints_gpd because read_staypoints_postgis also has a paramter called geom_col. I think the standard solution is to have an explicit parameter that might be called read_gpd_kwds and that is unpacked directly to the wrapped function. Examples:

henrymartin1 avatar May 20 '22 22:05 henrymartin1