<div dir="ltr"><div><div>Gdal gurus,<br><br>I'm writing a utility to automatically georeference Instrument Approach Procedures and Airport Diagrams from the FAA (<a href="http://github.com/jlmcgraw">github.com/jlmcgraw</a>, if you're curious) and I'm hoping for some insight from the experts here as to why I'm seeing the following behavior with Airport Diagrams<br>
<br></div>Most of the Airport Diagrams diagrams are portrait orientation (True North up), however some of them are actually laid out in landscape orientation (True North to the left or right) though the source PDF is still in portrait<br>
<br></div>If I georeference these landscape oriented using GCPs then gdalwarp will swap X and Y axes and also resize the resulting bitmap (it also resizes portrait oriented ones too, though without swapping axes)<br><div>
<div><div><br></div><div>My questions:<br></div><div style="margin-left:40px">1) Why is gdalwarp swapping the axes rather than using the X and Y pixel-skew parameters of the affine transformation (seems to be always 0)?<br>
</div><div style="margin-left:40px">2) Why is it re-sizing the bitmap?<br></div><div style="margin-left:40px">3) Do I have to do both of these steps separately (translate and then warp) or can I simplify somehow?<br></div>
<div><br>Steps in the process:<br><br></div><div style="margin-left:40px">1) Generate a list of Ground Control Points from the PDF, rasterize the PDF to a 300dpi PNG<br><br></div><div style="margin-left:40px">2) gdal_translate .PNG to an intermediate .VRT<br>
<div style="margin-left:40px">("gdal_translate -q -of VRT -strict -a_srs EPSG:4326 $gcpstring '$targetpng'  '$targetvrt'")<br></div></div><div><div style="margin-left:40px"><br>3) gdalwarp intermediate .VRT to get the final georeferenced output .VRT<br>
</div><div style="margin-left:80px"> ("gdalwarp -q -of VRT -t_srs EPSG:4326 -order 1 -overwrite ''$targetvrt''  '$targetvrt2'")<br></div><div><div><u><br><br><br><br>example from a landscape diagram</u><br>
</div><div>      <br><div style="margin-left:40px">(snippet of step 2 output from gdal_translate'd .vrt)<br></div></div><div style="margin-left:40px">
CA-SFO-00375AD-PDF-AIRPORT-DIAGRAM.vrt:<br></div><div style="margin-left:80px"><i><VRTDataset rasterXSize="<span style="background-color:rgb(255,153,0)">1613</span>" rasterYSize="<span style="background-color:rgb(0,255,0)">2475</span>"></i><br>

<br></div><div style="margin-left:40px">(snippet of step 3 output from gdalwarp'd .vrt)</div><div style="margin-left:40px">warpedCA-SFO-00375AD.PDF-AIRPORT\ DIAGRAM.vrt:<br></div><div style="margin-left:40px"><div style="margin-left:40px">
<i><VRTDataset rasterXSize="<span style="background-color:rgb(0,255,0)">2623</span>" rasterYSize="<span style="background-color:rgb(255,153,0)">1359</span>" subClass="VRTWarpedDataset"></i><br>
<i><GeoTransform> -1.2242081739746585e+02,  2.9114844968978991e-05,  0.0000000000000000e+00,  3.7641622693302779e+01,  0.0000000000000000e+00, -2.9114844968978991e-05</GeoTransform></i><br><br>
</div></div><div><div style="margin-left:40px"><br></div><u>example from a portrait diagram</u><br>          (snippet of step 2 output from gdal_translate'd .vrt)<br></div><div style="margin-left:40px"><i>VA-RIC-00347AD-PDF-AIRPORT-</i><i>DIAGRAM.vrt<br>
</i><div style="margin-left:40px"><i><VRTDataset rasterXSize="<span style="background-color:rgb(255,153,0)">1613</span>" rasterYSize="<span style="background-color:rgb(0,255,0)">2475</span>"></i><br>

<br></div></div><div style="margin-left:40px">(snippet of step 3 output from gdalwarp'd .vrt)</div><div style="margin-left:40px"><i>warpedVA-RIC-00347AD.PDF-</i><i>AIRPORT\ DIAGRAM.vrt<br></i></div><div style="margin-left:80px">
<i><VRTDataset rasterXSize="<span style="background-color:rgb(255,153,0)">1870</span>" rasterYSize="<span style="background-color:rgb(0,255,0)">2287</span>" subClass="VRTWarpedDataset"><br>
<GeoTransform> -7.7341103107298423e+01,  2.1580033523515700e-05,  0.0000000000000000e+00,  3.7529840835409082e+01,  0.0000000000000000e+00, -2.1580033523515700e-05</GeoTransform><br><br></i></div>Thanks!<br></div>
<div>-Jesse McGraw<br></div></div></div></div></div>