Question: exporting / writing auxiliary data without writing image data


sebastian.bullinger@...
 

Hi Loïc,

thank you for posting this workaround - sounds like a reasonable approach.

Best regards,
Sebastian


Loïc Dutrieux
 

Hi Sebastian,

Simply open a connection (in r+ mode) and closing it appears to work. See below.

import rasterio
from rasterio.crs import CRS
from affine import Affine
from PIL import Image
import numpy as np


arr = np.random.randint(1, 255, size=(200,200,3), dtype=np.uint8)
img = Image.fromarray(arr)

img.save('/tmp/test.png')

rasterio.open('/tmp/test.png', 'r+',
driver='PNG', width=200, height=200,
count=3, crs=CRS.from_epsg(4326),
transform=Affine.identity(), dtype=np.uint8).close()


Kind regards,
Loïc
________________________________________
From: main@rasterio.groups.io <main@rasterio.groups.io> on behalf of sebastian.bullinger@... <sebastian.bullinger@...>
Sent: 20 February 2022 21:53:45
To: main@rasterio.groups.io
Subject: [rasterio] Question: exporting / writing auxiliary data without writing image data

Hi everyone,

while saving a geo-referenced image to disk (using a standard file format like png), rasterio creates not only a file "output.png", but also a file "output.png.aux.xml" containing the corresponding geo-information.
Is it possible to create the "output.png.aux.xml" file without the creation of "output.png"?
Motivation: I hope to speed up the computation, since I already have the png images, but I'm interested in the (missing) aux.xml files (or any other file format that would allow me to show the images in QGIS with the correct geo-location).

Best regards,
Sebastian


sebastian.bullinger@...
 

Hi everyone,

while saving a geo-referenced image to disk (using a standard file format like png), rasterio creates not only a file "output.png", but also a file "output.png.aux.xml" containing the corresponding geo-information.
Is it possible to create the "output.png.aux.xml" file without the creation of "output.png"?
Motivation: I hope to speed up the computation, since I already have the png images, but I'm interested in the (missing) aux.xml files (or any other file format that would allow me to show the images in QGIS with the correct geo-location).


Best regards,
Sebastian