<div dir="ltr"><div>Ferdinand,</div><div>(re-adding gdal-dev after having exchanged off-list)<br></div><div>For your image with FIRST_COL set, you MUST use a gdal with <a href="https://github.com/OSGeo/gdal/pull/7653" target="_blank">https://github.com/OSGeo/gdal/pull/7653</a> included. The initial implementation in 5725 was incorrect in two ways: firstly ImagetoGround_Validity_Domain.* is informative only, and should never be used when applying RPCs. Secondly, as you noticed, that implementation only read FIRST_COL and applied it to both SAMP_OFFSET and LINE_OFFSET.</div><div>Concerning your particular product there was an error that occurred during the image production, and you should reach out to airbus's customer care for support.</div><div><br></div><div>best regards,</div><div>Thomas<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 24, 2023 at 7:00 PM Ferdinand <<a href="mailto:fwschenck@gmail.com" target="_blank">fwschenck@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi All, <br><br>We're seeing some major geolocation offsets in PNeo images (order of 1000m, depending on specific image). <br><br>I think I have tracked it down to having something to do with the validity domain. <br>In the cases where I see the offset, I often have metadata that looks like: <br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><ImagetoGround_Validity_Domain><br>  <FIRST_COL>-531</FIRST_COL><br>  <FIRST_ROW>-3182</FIRST_ROW><br>  <LAST_COL>33374</LAST_COL><br>  <LAST_ROW>27699</LAST_ROW><br>                          </ImagetoGround_Validity_Domain><br></blockquote><div><br> <br>From what I can grok from the code, it's an assumption that FIRST_COL and FIRST_ROW be 0 for PNeo, as discussed here: <a href="https://github.com/OSGeo/gdal/issues/5716" target="_blank">https://github.com/OSGeo/gdal/issues/5716</a><br><br>In an earlier version (than 3.7.1), FIRST_COL was manually subtracted from the line offset shift (<a href="https://github.com/OSGeo/gdal/pull/5725/files" target="_blank">https://github.com/OSGeo/gdal/pull/5725/files</a>), but that was reverted later, with the topLeftOffset manually set to 1 for PNeo: <a href="https://github.com/OSGeo/gdal/pull/7653/files" target="_blank">https://github.com/OSGeo/gdal/pull/7653/files</a><br><br>Can it be that this shift is not accounted for? <br><br>Basically, we create tifs by running gdal_translate on the DIM XML file, resulting in a tif with the RPC info inside. <br><br>Doing so on the same image for gdal 3.7.0 and 3.7.1 results in a diff of: <br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">89c88<br><   LINE_OFF=12836<br>---<br>>   LINE_OFF=12305<br>95c94<br><   SAMP_OFF=16819.5<br>---<br>>   SAMP_OFF=16288.5<br>104,105d102<br></blockquote><div><br>in the header. <br><br>The LINE_OFF gets shifted by 531 pixels, which is to be expected, but the SAMP_OFF also gets shifted by 531 pixels, which should not happen, right?  <br><br>Validating  in QGIS, the distance between Google Satellite and the one tower is 777m, at 30cm = 2590 pixels.<br>2590 + 531 = 3121, so within a misclick of 3182<br><br><br>Doing something a bit atrocious I subtracted FIRST_ROW from the LINE_OFF (<a href="https://github.com/fnands/rpcm/blob/1d4205d967985cfcc2426c3fd881352ce5b5ac46/rpcm/rpc_file_readers.py#L235" target="_blank">https://github.com/fnands/rpcm/blob/1d4205d967985cfcc2426c3fd881352ce5b5ac46/rpcm/rpc_file_readers.py#L235</a>), as well as adding FIRST COL to both, and then overwriting the RPC info. <br> This gets me pretty close, as least by visual inspection. <br><br>The diff between the manual one and the raster created with 3.7.1 is: <br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">88c89<br><   LINE_OFF=12305<br>---<br>>   LINE_OFF=14955<br>94c95<br><   SAMP_OFF=16288.5<br>---<br>>   SAMP_OFF=15756.5<br>102c103<br></blockquote><br><br>I feel like I am missing something here, and I am just throwing things at the wall and seeing what sticks. <br>If someone can help me get a more fundamental understanding of what is going wrong here I would greatly appreciate it. <br>Is this offset taken into account somewhere else? <br><br>Importantly, this is <span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">DIMAP v3, so not sure if that breaks anything. Waiting on our provider to send me some docs, as the latest ones I have for the RPC reference v2. <br></span><br><br>Cheers,</div><div><br></div><div>Ferdi<br><br><br><br><br></div></div></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>