Skip to content

fix: include shapefile companion files in archive zip#34

Open
zlplzp123wyt wants to merge 1 commit intoterrastackai:mainfrom
zlplzp123wyt:fix/shapefile-companion-files
Open

fix: include shapefile companion files in archive zip#34
zlplzp123wyt wants to merge 1 commit intoterrastackai:mainfrom
zlplzp123wyt:fix/shapefile-companion-files

Conversation

@zlplzp123wyt
Copy link
Copy Markdown

Fixes #32

Problem

When saving .shp files, the archive zip only contained the .shp file. Shapefiles require companion files (.shx, .dbf, .prj, .cpg) to be valid and loadable by GIS software like GeoServer.

Fix

When store_format == "shp", the code now:

  1. Discovers all companion files by checking for .shx, .dbf, .prj, .cpg alongside the .shp
  2. Zips all existing companion files together (only including files that actually exist)
  3. Passes the zip to GeoServer instead of the bare .shp file

This matches the existing pattern for gpkg files (which also use pack_files_in_zip).

When saving .shp files, the archive zip now includes all required
companion files (.shx, .dbf, .prj, .cpg) alongside the .shp file.
Shapefiles require these companion files to be valid and loadable
by GIS software like GeoServer.

Previously, only the .shp file was used directly without zipping
the companion files, causing import failures.

Fixes terrastackai#32
@zlplzp123wyt
Copy link
Copy Markdown
Author

Hi! This PR ensures shapefile companion files (.shx, .dbf, .prj) are included when archiving .shp files. Ready for review. Thanks!

@WanjiruCate
Copy link
Copy Markdown
Contributor

Hello @zlplzp123wyt thanks for the fix. This fix does solve another problem rather than the one in the initial issue. See this merged PR for the fix #33

@zlplzp123wyt
Copy link
Copy Markdown
Author

Hi @WanjiruCate, thanks for the review and clarification! I see that PR #33 addressed the original issue.

This PR focuses specifically on ensuring shapefile companion files (.shx, .dbf, .prj) are not dropped during archive operations — it's a complementary fix that prevents data loss when processing shapefile datasets.

Would you like me to update the PR description to better clarify the scope, or is there anything else needed to move this forward?

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

Successfully merging this pull request may close these issues.

[Bug]: Saving shape .shp files in the archive.zip requires other extensions

2 participants