johntruckenbrodt / pyroSAR

framework for large-scale SAR satellite data processing
MIT License
513 stars 112 forks source link

fix name laundering in export2shp #295

Closed MarkusZehner closed 7 months ago

MarkusZehner commented 8 months ago

Added a dict with shorter names in export2shp, using SQL to rename columns and switched to gdal.VectorTranslate for export. Postgres did not work locally, needs testing

johntruckenbrodt commented 7 months ago

Thanks @MarkusZehner! This doesn't seem to work with PostgreSQL yet, no idea when I'll get to it.

MarkusZehner commented 7 months ago

This is a very strange error, or am i missing something:

FAILED tests/test_drivers.py::test_archive_postgres - RuntimeError: ERROR:  column data.cyclenumber does not exist
LINE 1: ...r SELECT data.acquisition_mode as acq_mode, bbox, data.cycle...
                                                             ^
HINT:  Perhaps you meant to reference the column "data.cycleNumber".

The dict that handles the shorter names has no entry for all-lowercase 'cyclenumber', however the check does append a 'data.' in front, which should only be done for the column names present in the dict. The names for the columns are drawn from the get_colnames, so they should exist in the data table.

MarkusZehner commented 7 months ago

Fixed!

johntruckenbrodt commented 7 months ago

Awesome! Thanks a lot @MarkusZehner. I quickly did a little change myself. Should be ready to go now. I'll merge it once the tests are finished.