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

Allow setting metadata dict on a PDAL writer stage to enable metadata forwarding #147

Open
chambbj opened this issue Jul 25, 2023 · 3 comments

Comments

@chambbj
Copy link
Member

chambbj commented Jul 25, 2023

When working with Python, it is conceivable that users will read data via PDAL, operate on it using custom Python code, and then want to write the via PDAL. Currently, we can set certain metadata fields like scale and offset manually, but other metadata that would otherwise be forwarded in a traditional PDAL pipeline (at least with forward="all") cannot be so easily set. PDAL and the Python bindings need to provide a mechanism that would allow us to forward all metadata, but passing in the dict returned by pipeline.metadata when creating the writer stage.

@hobu
Copy link
Member

hobu commented Aug 4, 2023

What other metadata do you need to set here? The only other thing I can think of is any VLRs, but it is probably better to ferry those yourself so you get what you want.

If we were to do anything on this, I wonder if adding a settable metadata node to pdal::Stage pipeline members is the way to do it, not by patching something into the python bindings here.

@leavauchier
Copy link

Hello,
I'm not sure if this would help, but I have one use case of the proposed mechanism : if you have a las reader, you do some specific stuff in python with your data and you want to write an output las file with the same srs, las_version, dataformat_id, extra_dimensions, etc... In case everything can't be done in a single pipeline, all this info would need to be fetched and parsed one by one, with the risk that some metadata are forgotten, so this could be handy to ba able do directly forward the whole metadata dict

@diego-gris
Copy link

@hobu, I agree with @leavauchier. I've noticed that if I capture the outputs of a Reader as a numpy array and later try to write them to a .las file by passing the numpy array to the Pipeline constructor method, the output file is missing CRS information. It would be great if we could also pass the metadata to the writer after processing the arrays in Python so that we can write files the same way we do when writing them directly after reading on the same pipeline.

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

4 participants