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

ogr2ogr: Shapefile outputs multiple files #45

Closed
disarticulate opened this issue Nov 6, 2022 · 1 comment
Closed

ogr2ogr: Shapefile outputs multiple files #45

disarticulate opened this issue Nov 6, 2022 · 1 comment

Comments

@disarticulate
Copy link

Everyone hates shapefiles: it generates multiple files: https://gdal.org/drivers/vector/shapefile.html

Currently, only the obvious *.shp file is presented as filePath. It should be generating at least three (four typically) files: .shp, .shx, and .dbf

to allow the ogr2ogr api seems it seems two options:

  1. return an array of filepaths to each file
  2. return a directory (ogr2ogr will use directories if they're passed in; and can output to a folder)

it looks like these files are being generated:

//const files = await gdal.getOutputFiles()
0: {path: '/output/design-features.shp', size: 14500}
1: {path: '/output/design-features.shx', size: 476}
2: {path: '/output/design-features.dbf', size: 1696}
3: {path: '/output/design-features.prj', size: 597}

so a initial work around would be to get output files instead of relying on the return value of ogr2ogr, but that would requiree knowing what these files are in advance (writing a special shaprefile only converter), which is difficult because of #44 as processing can't dictate the output filename, so no general purpose function seems reliable

to support shapefiles (or others?), I'd propose returning an array from ogr2ogr if multiple files are created or documenting this behavior and implementing a fix for #44

bugra9 added a commit that referenced this issue Dec 10, 2023
feat: add env param to config to set global gdal configuration
feat: add gdalinfo and ogrinfo apps and add the app results to dataset object
fix: raster/vector type calculation
fix: prevent app from terminating if a warning occurs
fix: support node.js >= 18
chore: update emscripten version to 3.1.50 (temporary disable PDS driver)
feat: list all created files with all param in the outputs of ogr2ogr, gdal_translate, gdalwarp, gdal_rasterize #45
feat: add outputName param to ogr2ogr, gdal_translate, gdalwarp, gdal_rasterize #44
fix: mocha issue causing tests not to start for Chrome
feat: add playground to test
feat: add more info about dataset in gdal3.js gui
@bugra9
Copy link
Owner

bugra9 commented Dec 11, 2023

Hi @disarticulate,

I added the "all" attribute that lists all generated files in the ogr2ogr, gdal_translate, gdalwarp and gdal_rasterize outputs.
https://gdal3.js.org/docs/TypeDefs.html#.FilePath

Will it work?

@bugra9 bugra9 closed this as completed Dec 14, 2023
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