[gdal-dev] Troubles with PAM file

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Troubles with PAM file

domlysz
Hi all,

I'm trying to read a raster georeferenced with ArcGIS. It's a jpg file coming with a PAM file (.aux.xml) that store GCPs and define a polynomial transformation of order 3. Unfortunately GDAL does not take the PAM file into account and gdalinfo does not report GCPs. After some investigations, I found this commit that suggest PAM files are supported by GDAL but only for TIFF dataset. So, I've translated my file to TIFF and now gdalinfo report the GCPs but the file is not correctly georeferenced. Reading more carefully the commit previously cited I can see some relevants clues : sources GPCs are considered to be expressed in inch and so the code rely on image dpi stored in TIFF tags to compute the pixels coordinates. Futhermore the origin of pixels coordinates is considered to be the bottom left. I've checked my PAM file and clearly the sources GPC are expressed directly in pixel, not inch, with an image origin fixed to top left. I can set the dpi of my image to 1 to fix the scale but Y coordinates remains wrong.

I'm a bit confused with theses PAM files, is there any technical doc from ESRI? My PAM file make sense for me : pixel coordinates and top left origin (like worldfile) for sources GPC, it's seems a very common approach. But inch !? Also is there any particular reason to limit PAM file reading to TIFF dataset ? maybe is it related to the need to extract dpi from tags ?

For now I can't see any way to correctly read this file with GDAL, so I'm thinking of writing my own script to parse GCPs and rectify the raster wih gdalwarp. Not sure if it will be the best approach here, any advices?


Thanks in advance for any feedback on this.

Regards

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with PAM file

Even Rouault-2
Dominique,
>
> I'm trying to read a raster georeferenced with ArcGIS. It's a jpg file
> coming with a PAM file (.aux.xml) that store GCPs and define a polynomial
> transformation of order 3. Unfortunately GDAL does not take the PAM file
> into account and gdalinfo does not report GCPs. After some investigations,
> I found this commit
> <https://github.com/OSGeo/gdal/commit/f8822eb50466fb740e228b8c6a7f066b916faa
> 0a> that suggest PAM files are supported by GDAL but only for TIFF dataset.

Not really. PAM files are supported for most formats, included JPEG, but the
ESRI specific GCP decoding was limited for now to the GTiff format, mostly
because of the oddity you noticed: in the case for which this was developed
for
(see https://lists.osgeo.org/pipermail/gdal-dev/2017-January/045854.html and
the related email thread), pixel coordinates were indeed surprisingly in
inches and from the bottom left origin. So I couldn't/didn't want to
generalize that to core PAM processing.

>
> I'm a bit confused with theses PAM files, is there any technical doc from
> ESRI?

Not to my knowledge. Initially PAM was developed for GDAL itself, but it seems
ESRI developed some extensions on top of it, like the one you are facing to.

> The file can be downloaded here :
> https://drive.google.com/drive/folders/1hZXncJhcfZI0Uem-oCfUsruO9mPwWD0U?usp
> =sharing

You didn't include the most interesting part, that is the .aux.xml file itself

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with PAM file

domlysz
Thank you Even for these informations, that's good to know. I've added the .aux.xml in the repository if it can be useful as reference. Finally, I got good results with gdal_translate -gcp option following by gdalwarp. Fun fact, in the PAM file Y image coordinates are negatives values but must be pushed as positive number in gdal_translate command.

Le mer. 20 mars 2019 à 15:57, Even Rouault <[hidden email]> a écrit :
Dominique,
>
> I'm trying to read a raster georeferenced with ArcGIS. It's a jpg file
> coming with a PAM file (.aux.xml) that store GCPs and define a polynomial
> transformation of order 3. Unfortunately GDAL does not take the PAM file
> into account and gdalinfo does not report GCPs. After some investigations,
> I found this commit
> <https://github.com/OSGeo/gdal/commit/f8822eb50466fb740e228b8c6a7f066b916faa
> 0a> that suggest PAM files are supported by GDAL but only for TIFF dataset.

Not really. PAM files are supported for most formats, included JPEG, but the
ESRI specific GCP decoding was limited for now to the GTiff format, mostly
because of the oddity you noticed: in the case for which this was developed
for
(see https://lists.osgeo.org/pipermail/gdal-dev/2017-January/045854.html and
the related email thread), pixel coordinates were indeed surprisingly in
inches and from the bottom left origin. So I couldn't/didn't want to
generalize that to core PAM processing.

>
> I'm a bit confused with theses PAM files, is there any technical doc from
> ESRI?

Not to my knowledge. Initially PAM was developed for GDAL itself, but it seems
ESRI developed some extensions on top of it, like the one you are facing to.

> The file can be downloaded here :
> https://drive.google.com/drive/folders/1hZXncJhcfZI0Uem-oCfUsruO9mPwWD0U?usp
> =sharing

You didn't include the most interesting part, that is the .aux.xml file itself

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with PAM file

domlysz
If it can be useful to anyone facing the same issue, my little script for parsing these aux.xml and writing the expected GDAL commands to rectify the raster is available here https://github.com/domlysz/PAM-GCPs-warper

Regards

Le mer. 20 mars 2019 à 18:09, Dominique Lyszczarz <[hidden email]> a écrit :
Thank you Even for these informations, that's good to know. I've added the .aux.xml in the repository if it can be useful as reference. Finally, I got good results with gdal_translate -gcp option following by gdalwarp. Fun fact, in the PAM file Y image coordinates are negatives values but must be pushed as positive number in gdal_translate command.

Le mer. 20 mars 2019 à 15:57, Even Rouault <[hidden email]> a écrit :
Dominique,
>
> I'm trying to read a raster georeferenced with ArcGIS. It's a jpg file
> coming with a PAM file (.aux.xml) that store GCPs and define a polynomial
> transformation of order 3. Unfortunately GDAL does not take the PAM file
> into account and gdalinfo does not report GCPs. After some investigations,
> I found this commit
> <https://github.com/OSGeo/gdal/commit/f8822eb50466fb740e228b8c6a7f066b916faa
> 0a> that suggest PAM files are supported by GDAL but only for TIFF dataset.

Not really. PAM files are supported for most formats, included JPEG, but the
ESRI specific GCP decoding was limited for now to the GTiff format, mostly
because of the oddity you noticed: in the case for which this was developed
for
(see https://lists.osgeo.org/pipermail/gdal-dev/2017-January/045854.html and
the related email thread), pixel coordinates were indeed surprisingly in
inches and from the bottom left origin. So I couldn't/didn't want to
generalize that to core PAM processing.

>
> I'm a bit confused with theses PAM files, is there any technical doc from
> ESRI?

Not to my knowledge. Initially PAM was developed for GDAL itself, but it seems
ESRI developed some extensions on top of it, like the one you are facing to.

> The file can be downloaded here :
> https://drive.google.com/drive/folders/1hZXncJhcfZI0Uem-oCfUsruO9mPwWD0U?usp
> =sharing

You didn't include the most interesting part, that is the .aux.xml file itself

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev