[gdal-dev] Reading shapefile from ZIP archive (c++)
Daniel Evans
daniel.fred.evans at gmail.com
Tue Sep 6 07:50:05 PDT 2022
Hi Sharon,
I think all you need to do is define the path to open as:
'/vsizip//parks-and-recreation-feature-map-d.zip/parks-and-recreation-feature-map/parks-and-recreation-feature-map.shp'
i.e. defining the filepath as:
/vsizip/<path to the zip>/<path inside the zip>
When the zip contains only a single (shape)file at the top level - the
case where you've got it working - GDAL automatically determines the
file to open.
Docs at: https://gdal.org/user/virtual_file_systems.html#vsizip-zip-archives
Cheers,
Daniel
On Tue, 6 Sept 2022 at 15:30, Sharon Eldor <seldor at kinetica.com> wrote:
> Hi,
> Trying to read shapefiles from a zip archive, I am running:
>
> GDALDataset::Open('/vsizip//parks-and-recreation-feature-map-d.zip', GDAL_OF_VECTOR |
>
> GDAL_OF_READONLY | GDAL_OF_VERBOSE_ERROR | GDAL_OF_SHARED,
>
> NULL, NULL, NULL )
>
>
> When there is a directory in the zip, I get an error:
>
> Error: `/vsizip//parks-and-recreation-feature-map-d.zip' not recognized as a supported file format.
>
>
> When the files are not under a directory in the zip (same files), the zip file is read with no error.
>
> Attaching 2 files for example.
>
> Is there a way to directly read the files from the archive with the directory?
>
>
>
> Thanks,
>
> Sharon
>
>
>
>
>
>
>
> *The contents of this email message and any attachments are the property
> of Kinetica DB, Inc. and may contain confidential or privileged information
> intended solely for the addressee(s). Unauthorized use of this
> communication is strictly prohibited and may be unlawful. If you have
> received this communication in error, please notify the sender by reply
> e-mail, then delete all copies of the communication and any attachments.*
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220906/1a875e08/attachment-0001.htm>
More information about the gdal-dev
mailing list