<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>This might be tricky, because JPEG2000 itself has a concept of a
image space origin which is not necessarily (0,0) with the (XOSiz, YOSiz)
fields of the SIZ marker, although most of the time it is 0,0. I
don't remember how the GDAL JPEG2000 drivers behave regarding
that, if they ignore it (that is the GDAL 0,0 pixel is the one at
(XOSiz,YOSiz)), of if the first valid pixel in GDAL image space is
actually (XOSiz, YOSiz) and you have padding pixels between 0 and
XOSiz/YOSiz.<br>
</p>
<p>You can get the XOSiz, YOSiz value with the
<a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/master/swig/python/gdal-utils/osgeo_utils/samples/dump_jp2.py">https://github.com/OSGeo/gdal/blob/master/swig/python/gdal-utils/osgeo_utils/samples/dump_jp2.py</a>
script<br>
</p>
<p>Depending on how drivers behave, the combination of this JPEG2000
imaging (XOSiz, YOSiz) concept with the gml:low shift from GMLJP2
might actually cancel and lead to the right result...</p>
<p>In any case data producers are calling for troubles by using any
of those mechanisms...<br>
</p>
<div class="moz-cite-prefix">Le 29/03/2024 à 09:45, Philippe
Ghesquiere via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAAes_OHSdRL+dnGmK-87M_99ZvBGiXHBuSo_4Ha6obshHwSyHQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div><span
style="color:rgb(94,94,94);font-family:"Google Sans",Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px">Hi
all,</span><br>
</div>
<div><br>
</div>
<div>I have some questions about GMLJP2 parameters concerning
location.</div>
<div><br>
</div>
<div><b>1) Description<br>
</b>Some JP2K images have a pixel origin different than (0 ;
0) (DIMAP products for example).<br>
<br>
In such cases, the GML header looks like like:<br>
<gml:GridEnvelope><br>
<b><gml:low>7 7</gml:low> <==========
Different than "0 0"</b><br>
<gml:high>1000 1000</gml:high><br>
</gml:GridEnvelope><br>
<br>
This origin coordinate should be taken into account for pixel
location (See OGC 05-047r3 p93):<br>
<element name="startPoint" type="gml:integerList"
minOccurs="0"><br>
<annotation><br>
<documentation><br>
Index position of the first grid post, which<br>
shall lie somwhere in the GridEnvelope. If
absent, the startPoint is equal<br>
to the value of gridEnvelope::low from the grid
definition.<br>
</documentation><br>
</annotation><br>
</element><br>
<br>
It seems that this offset is not taken into account by GDAL
location function.<br>
</div>
<div><br>
</div>
<div><b>2) How to reproduce</b><br>
2.1) Data creation<br>
Reference (no offset) image:<br>
gdal_create -of JP2OpenJPEG -co GMLJP2=YES -outsize 100 100
-bands 3 -burn 0 -burn 255 -burn 0 -a_srs epsg:32632 -a_ullr
500000 500100 500100 500000 Offset_0.jp2<br>
<br>
</div>
<div>Image with offset:<br>
sed s/"<gml:low>0 0"/"<gml:low>7 7"/g Offset_0.jp2
> Offset_7.jp2<br>
<br>
</div>
<div>2.2) Location test<br>
echo "0 0" | gdaltransform Offset_0.jp2 Offset_7.jp2<br>
0 0 0<br>
<br>
</div>
<div><b>3) Question:</b></div>
<div>Shouldn't we have a 7 pixels offset between the 2 images</div>
<div><br>
</div>
<div>Cheers</div>
<div>Philippe</div>
<div><br>
</div>
<div><br>
</div>
</div>
<font style="font-size: 9px;">The information in this e-mail is
confidential. The contents may not be disclosed or used by
anyone other than the addressee. Access to this e-mail by anyone
else is unauthorised.<br>
If you are not the intended recipient, please notify Airbus
immediately and delete this e-mail.<br>
Airbus cannot accept any responsibility for the accuracy or
completeness of this e-mail as it has been sent over public
networks. If you have any concerns over the content of this
message or its Accuracy or Integrity, please contact Airbus
immediately.<br>
All outgoing e-mails from Airbus are checked using regularly
updated virus scanning software but you should take whatever
measures you deem to be appropriate to ensure that this message
and any attachments are virus free.</font><br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>