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

GeoArrays.write("output.png", ga) creates unnecessary "output.png.aux.xml" file #164

Open
hawahee opened this issue Sep 30, 2024 · 3 comments

Comments

@hawahee
Copy link

hawahee commented Sep 30, 2024

When exporting an image with an undefined coordinate reference system using GeoArrays.write("output.png", ga) an unnecessary output.png.aux.xml file is created that contains the following:

<PAMDataset>
  <GeoTransform> 0.0000000000000000e+000, 1.0000000000000000e+000, 0.0000000000000000e+000, 0.0000000000000000e+000, 0.0000000000000000e+000, 1.0000000000000000e+000</GeoTransform>
</PAMDataset>

Can the write method be changed to not write such unnecessary files when there is no defined CRS?
Using ArchGDAL instead of GeoArrays does not produce the .aux.xml file.

Steps to reproduce:

using GeoArrays

z = rand(UInt8, 10, 10)

ga = GeoArrays.GeoArray(z)

GeoArrays.write("output.png", ga)
@evetion
Copy link
Owner

evetion commented Oct 3, 2024

Thanks for reporting! Interesting that ArchGDAL doesn't write the aux file.

I'd have to check if not setting some spatial information writes only the png. Then again, this whole library is for spatial information. I was thinking about always writing a crs (local engineering crs if none was provided), which wouldn't help here.

Can I ask what your use case is here? Do you just want to write png from an array, or is there an (unknown) spatial component?

@evetion
Copy link
Owner

evetion commented Oct 4, 2024

Looking into a bit, it seems controlled by metadata options such as https://gdal.org/en/latest/user/configoptions.html#persistent-auxiliary-metadata-pam-options. I can't reproduce this on macos, but it seems on windows and linux it does write metadata.

Could you try to run GeoArrays.ArchGDAL.setconfigoption("GDAL_PAM_ENABLED","NO") and then see whether the .png is created or not?

@hawahee
Copy link
Author

hawahee commented Oct 5, 2024

Can I ask what your use case is here? Do you just want to write png from an array, or is there an (unknown) spatial component?

Yes, I just want to write a png from an array. I sometimes have a RGB image with a spatial component and just want to remove the spatial component and save it. I could use a different library for that, but it was easier for me to also use the GeoArrays library for that.

Could you try to run GeoArrays.ArchGDAL.setconfigoption("GDAL_PAM_ENABLED","NO") and then see whether the .png is created or not?

That did stop the write from creating the .aux.xml file.

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