- Writing ESRI sidecar files
Re: Writing ESRI sidecar files
Thanks again Sean, and Evan too. It seems I just need to get the right
combination of options.
The options that you have shown Even ....how are they implemented?
They don't seem to go in the Env like the other options?
Correct, those dataset creation options need to be passed into rasterio.open().
One way to do that is to add to your metadata dict below
metadata["profile"] = "GeoTIFF"
My code at the moment as follows. It create the .tif and .ovr file .
If anyone can improve it, and help me get the aux.xml file too I'd be
very grateful. I need the ovr and aux.xml files to be created
independently as it's what the client needs.
with rasterio.open("meri50year.tif") as file:
data = file.read(1)
metadata = file.profile
metadata['nodata'] = 255
data[data == 1 ] = 4
data[data == 15 ] = 255
outfile = 'meri50_processed.tif'
with rasterio.Env(GDAL_PAM_ENABLED=True, ESRI_XML_PAM=True, TIFF_USE_OVR=True):
with rasterio.open(outfile, 'w', **metadata) as new_temp_file:
overviews = [2,4,8,16]
On Fri, 28 Jun 2019 at 16:09, Even Rouault <even.rouault@...> wrote:
> On vendredi 28 juin 2019 08:26:35 CEST Sean Gillies wrote:
> > If you are creating a GeoTIFF it is possible that no XML file will be
> > written. As Even Rouault explains in
> > https://lists.osgeo.org/pipermail/gdal-dev/2010-May/024522.html, the PAM
> > file is only created if needed.
> Indeed. You can play with the GTIFF specific PROFILE creation option
> (see https://gdal.org/drivers/raster/gtiff.html#creation-issues)
> PROFILE=BASELINE: .aux.xml only created if presence of georeferencing and/or
> user metadata
> PROFILE=GEOTIFF: .aux.xml only created if there's user metadata
> PROFILE=GDALGeoTIFF: .aux.xml only created if user metadata doesn't fit in
> TIFF tag
> Spatialys - Geospatial professional services
Join email@example.com to automatically receive all group messages.