jonas-p / go-shp

Go library for reading and writing ESRI Shapefiles. Pure Golang implementation based on the ESRI Shapefile technical description.
MIT License
258 stars 68 forks source link

ZIPReader should make less assumptions on file name #14

Closed fawick closed 7 years ago

fawick commented 7 years ago

(idea originally by @tdilo)

At the moment OpenZip assumes that the shapefile lies in the root of the archived filetree and has the same basename as the archive file.

The idea is to lift the restriction by scanning through the archive and using the relative path and basename of the first found shapefile.

fawick commented 7 years ago

IMHO OpenZip could still require that there is exactly one shapefile within the archive and return an error if that is not the case (0 or 2+ shapefiles) This would take care of the problem that the wrong file is returned to the user.

Another function OpenZipWithName(path, archivedPath) could offer the possibility to load a specified shapefiles from archives that hold one or more shapefiles.

@tdilo What do you think?

tdilo commented 7 years ago

Sounds good. This begs the question whether listing of valid shapefile names should be supported as well.

fawick commented 7 years ago

@tdilo Thx for the review, pls take another look.