osm-fr / osmose-backend

Part of osmose that runs the analysis, and send the results to the frontend.
GNU General Public License v3.0
94 stars 115 forks source link

extract="*.shp" won't work in Source to get shapefile out of a rar file #2392

Open flacombe opened 4 hours ago

flacombe commented 4 hours ago

In a new analyzer, I intend to extract some shapefiles from a rar file with the following :

Data is in this rar file: https://www.data.gouv.fr/fr/datasets/supports-eclairage-public-du-sde18/

       GDAL(SourceDataGouv(
                    attribution="SDE 18",
                    dataset="673b1255be2baa1d2a71c950",
                    resource="a6296c3c-8f51-485c-a6c7-c0cead86d474",
                    extract="*.shp"
       ),
       srid = 2154)

But it leads to the following error:

2024-11-18 22:22:37 france_centre_cher : merge_power_pole_FR_spec_sde18 2024-11-18 22:22:37 error: Fails to get status from frontend: 404 2024-11-18 22:22:37 run osmosis all analyser Analyser_Merge_power_pole_FR_spec_sde18 2024-11-18 22:22:37 Analyser_Merge.py:1285 sql 2024-11-18 22:22:37 Analyser_Merge.py:870 sql 2024-11-18 22:22:37 Analyser_Merge.py:882 sql 2024-11-18 22:22:37 Load raw data into database 2024-11-18 22:22:37 Analyser_Merge.py:900 sql ogr2ogr -f PostgreSQL 'PG:host=postgis dbname=osmose user=osmose password=-osmose- options=--search_path=france_centre_cher,public ' -lco SCHEMA=osmose -nln 'power_pole_fr_spec_sde18' -clipsrc 'POLYGON ((603472.43880277 6674207.196722454, 617152.0087755943 6692448.940047571, 628550.3260745336 6692345.192453721, 634285.8021618618 6727208.156868122, 647630.0553177457 6730552.248830497, 692146.1095182694 6717958.127444516, 710749.0033116698 6660061.203124669, 709159.6387588142 6634457.48451167, 676937.7449323979 6617836.462224709, 672867.1803628255 6601492.227619882, 634629.9801152875 6587035.021270143, 622030.5050749364 6637762.485723911, 625956.0068082098 6654972.632986181, 603821.0746228623 6666923.819600275, 603472.43880277 6674207.196722454))' -nlt PROMOTE_TO_MULTI -lco OVERWRITE=yes -lco GEOMETRY_NAME=geom -lco OVERWRITE=YES -lco LAUNDER=NO -skipfailures -s_srs EPSG:2154 -t_srs EPSG:2154 '/tmp/tmp5ptj6yfl' FAILURE: Unable to open datasource /tmp/tmp5ptj6yfl' with the following drivers. ->FITS' -> PCIDSK' ->netCDF' -> PDS4' ->VICAR' -> `JP2OpenJPEG' ...

Is it possible the extract=* feature in the Source abstract class won't extract anything or am I doing anything wrong?

frodrigo commented 3 hours ago

I think, it could not work with shape file into a rar.

extract only extract one content from archive. Even if you can write a pattern to get all the files required for a shape file, the content will be concatened into one stream, and this will not work.

Shape file only work with zip because gdal is able to read that directly.