<div dir="ltr"><div><div><div><div><div><div>Jukka,<br><br></div>Part of why behavior is inconsistent now is that the logic is in each driver.  Some might give precidence to a world file over something internal, or to .aux.xml.<br>
<br></div>I think it would be *desirable* for .aux.xml to take precedence over internal information<br></div> when it is available as it is normally only in the .aux.xml file because it was updated or accurate information could not be written within the file itself.<br>
<br></div>I'm not sure how we would go about updating all drivers to have consistent behavior.  I do like the idea that drivers can control this.  I just think it would be good to have a suggested behavior we aim for.<br>
<br></div>I'm not too keen on a configuration option as those are always a sort of hack, though it is possible.<br><br></div>I will note you can always "gdal_translate" to VRT and then hand edit or alter it with gdal_edit.py to get a wrapped dataset with the desired georeferencing and other metadata.<br>
<br>Best regards,<br>Frank<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Oct 27, 2013 at 4:02 PM, Jukka Rahkonen <span dir="ltr"><<a href="mailto:jukka.rahkonen@mmmtike.fi" target="_blank">jukka.rahkonen@mmmtike.fi</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Sometimes an image can have several and ambiguous metadata for<br>
georeferencing. Mapserver has a method to deal with ambiguous internal<br>
geotiff metadata and world files and user can override the internal metadata<br>
by using PROCESSING "EXTENT_PRIORITY=WORLD" in the mapfile.<br>
<a href="http://www.mapserver.org/input/raster.html#special-processing-directives" target="_blank">http://www.mapserver.org/input/raster.html#special-processing-directives</a>.<br>
I thought it was PROCESSING "EXTENT_PRIORITY=WORLDFILE" but perhaps both<br>
keywords are supported.<br>
<br>
I wonder if GDAL supports this same worldfile override with some secret<br>
config option. At least it is not listed on page<br>
<a href="http://trac.osgeo.org/gdal/wiki/ConfigOptions" target="_blank">http://trac.osgeo.org/gdal/wiki/ConfigOptions</a>.<br>
<br>
I can also see that GDAL does have a config option GMLJP2OVERRIDE but I<br>
could not easily find what is is doing.<br>
<br>
And finally when I was playing with a "gdal_edit.py" utility I discovered<br>
that there are at least 4 ways to georeference a JPEG2000 file:<br>
- use worldfile .wld or .j2w<br>
- use internal GeoJP2 (GeoTIFF) georeferencing<br>
- use internal GML georeferencing<br>
- use an external .aux.xlm file<br>
<br>
I noticed that command<br>
 python gdal_edit.py -a_srs epsg:3067 metajp2test.jp2<br>
was creating a file names "metajp2test.jp2.aux" which does contain the right<br>
georeferencing data.  However, if I run gdalinfo it is looking for the<br>
internal GeoJP2 metadata and it reports that my JPEG2000 file is still using<br>
an unknown projection.<br>
<br>
This feels a bit messy. Perhaps there is a need to have a GDAL wide config<br>
option for what metadata to search and use for georeferencing. In my case I<br>
would like to set it to use "external GDAL aux.xml". In addition, I think<br>
that this setting should be made safe so that if aux.xml file is not found<br>
then the image is considered to be without georeferencing. Or perhaps the<br>
config option could take a list like "auxiliary_xml,GeoJP2" with all the<br>
acceptable alternatives in priority order.<br>
<br>
-Jukka Rahkonen-<br>
<br>
<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up   | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/~warmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>and watch the world go round - Rush    | Geospatial Software Developer<br>
</div>