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: allow/store dst_datasource_name for output #44

Closed
disarticulate opened this issue Nov 6, 2022 · 3 comments
Closed

ogr2ogr: allow/store dst_datasource_name for output #44

disarticulate opened this issue Nov 6, 2022 · 3 comments

Comments

@disarticulate
Copy link

So ogr2ogr is generally:
ogr2ogr [options] dst_datasource_name src_datasource_name [layers]

and the current api is:

dataset // src_datasource_name
options // options
const filePath = await Gdal.ogr2ogr(dataset, options)

For certain conversions or operations, a dst_datasource_name can be updated with option switches like -append/-overwrite/-update.

Current behavior appears to directly create the output name as the input name, which prevents a one to many relationship, particularly when using the -sql switch which operates and generates a layer.

I'd recommend the following api if it can be mapped easily to the current:

Gdal.ogr2ogr(dataset, options, [output_name])

I think the substantial API dillema is whether that output_name include the /output/* directory prefix but since the return file is the defacto working object, I think just allowing arbitrary output names then returning the location to the dataset fullfills the current contract without breaking how workflow occurs.

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

@bugra9 bugra9 closed this as completed Dec 14, 2023
@disarticulate
Copy link
Author

disarticulate commented Aug 19, 2024

This does appear to work.

A follow up question: when the dataset is closed, it still exists. How do we flush the fly? It looks like we need acceess to a FS.unlink in emscriptem. In general, it'd be nice to have access to the FS for pre- and post- processing activities.

Do you want me to open a separate issue?

@bugra9
Copy link
Owner

bugra9 commented Aug 25, 2024

I have exported FS for the issue (#67). It can be used as specified there.

I'm also thinking of removing the virtual filesystem in node.js for the next version of gdal3.js (3.0.0). If you're using it on node.js, you might not need it.

V3.0.0 PR: #82

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