Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
flacombe opened this issue Nov 18, 2024 · 4 comments
Open

Comments

@flacombe
Copy link
Contributor

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?

@flacombe flacombe changed the title extract won't work in Source to extract shapefile in a rar file extract="*.shp" won't work in Source to get shapefile out of a rar file Nov 18, 2024
@frodrigo
Copy link
Member

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.

@flacombe
Copy link
Contributor Author

Ok thanks for details.

Isn't it possible to improve it to extract files as they are in the archive?
Concatenate into one stream sounds like very particular.

@frodrigo
Copy link
Member

frodrigo commented Nov 19, 2024 via email

@flacombe
Copy link
Contributor Author

I've asked for zip instead of rar.

But someone else could come and ask for any other possibility involving several files in a rar in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants