jlmcgraw / GeoReferencePlates

A utility for automatically georeferencing FAA / AeroNav Instrument Approach Plates and Airport Diagrams
GNU General Public License v3.0
26 stars 10 forks source link

Changes In APD Format Break Regex? #5

Open ssokol opened 2 years ago

ssokol commented 2 years ago

Hi Jesse,

Sorry to bother you with this, but my regex skills are almost nonexistent, my limited perl experience is 20 years out of date, and I seem to have run into a change in the format of the text in the airport diagram PDF documents that has broken the georeference system.

Both findLatitudeTextBoxes2 and findLongitudeTextBoxes2 are failing to find the required text. My assumption is that the FAA made some slight change in how it encodes the values which has broken the regexs that do the hard work here. I've included the debug output for one chart (it's for KGTU - Georgetown Municipal in Georgetown Texas). Any idea what need to be changed to find the text and the lines?

Here are the lines that should work:

<word xMin="274.595200" yMin="55.246143" xMax="303.050420" yMax="59.457243">97°40.5&apos;W</word>
<word xMin="274.595200" yMin="55.246143" xMax="303.050420" yMax="59.457243">97°40.5&apos;W</word>
 <word xMin="328.761700" yMin="201.531943" xMax="357.215829" yMax="205.743043">30°41.0&apos;N</word>
<word xMin="331.713100" yMin="420.710343" xMax="360.167229" yMax="424.921443">30°40.5&apos;N</word>

I'm not sure when the FAA changed things up - I'm just now starting to add charts and plates to my stuff. I greatly appreciate any pointers to get this working.

Best Regards,

Steve

ssokol@charter:~/GeoReferencePlates$ ./georeference_airport_diagrams_via_db.pl -v -c 2201 plates/
Supplied cycle: 2201
Processing 1 charts
SC-3, GTU, 70000, APD, AIRPORT DIAGRAM, , 05724AD.PDF, , N, , TX
plates/05724AD.PDF
Directory: plates/
File:      05724AD
Suffix:    .PDF

TargetPdf: plates/05724AD.PDF
OutputPdf: plates/marked-05724AD.pdf
TargetPng: plates/05724AD.png
TargetTif: plates/05724AD.tif
TargetVrt: plates/TX-GTU-05724AD-PDF-AIRPORT-DIAGRAM.vrt
targetStatistics: ./statistics.csv

Airport ID: GTU
Airport Latitude: 30.6788055555556
Airport Longitude: -97.6793888888889
Airport Name: GEORGETOWN MUNI
30 N, 98 W
PDF Mediabox size: 387.36x594
PDF Mediabox center: 193.68x297
PDF X/Y Ratio: 0.652121212121212
plates/05724AD.png already exists
PNG size: 1614x2475
Scalefactor PDF->PNG X:  4.16666666666667
Scalefactor PDF->PNG Y:  4.16666666666667
PNG X/Y Ratio:  0.652121212121212
Use of uninitialized value $_objectstreams in concatenation (.) or string at ./georeference_airport_diagrams_via_db.pl line 693.
Object streams:
:findAllIcons
Use of uninitialized value $objectstreams in subtraction (-) at ./georeference_airport_diagrams_via_db.pl line 772.

:findAllTextboxes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>05724AD</title>
<meta name="Subject" content=""/>
<meta name="Keywords" content=""/>
<meta name="Author" content=""/>
<meta name="Creator" content="Aspose Ltd."/>
<meta name="Producer" content="Aspose.PDF for .NET 19.11"/>
<meta name="CreationDate" content=""/>
</head>
<body>
<doc>
  <page width="387.360000" height="594.000000">
    <word xMin="18.214200" yMin="27.459543" xMax="37.051854" yMax="31.670643">21224</word>
    <word xMin="258.129900" yMin="29.469543" xMax="320.687983" yMax="35.300643">GEORGETOWN</word>
    <word xMin="322.905097" yMin="29.469543" xMax="373.152746" yMax="35.300643">MUNI(GTU)</word>
    <word xMin="18.214200" yMin="36.076642" xMax="63.754141" yMax="44.110042">AIRPORT</word>
    <word xMin="66.415428" yMin="36.076642" xMax="117.267298" yMax="44.110042">DIAGRAM</word>
    <word xMin="173.995800" yMin="38.977343" xMax="197.723841" yMax="43.188443">AL-5724</word>
    <word xMin="199.341956" yMin="38.977343" xMax="216.597536" yMax="43.188443">(FAA)</word>
    <word xMin="305.577400" yMin="38.977343" xMax="349.844816" yMax="43.188443">GEORGETOWN,</word>
    <word xMin="351.359994" yMin="38.977343" xMax="370.887597" yMax="43.188443">TEXAS</word>
    <word xMin="21.813500" yMin="50.234143" xMax="35.010080" yMax="54.445243">ATIS</word>
    <word xMin="85.172700" yMin="55.174143" xMax="113.627920" yMax="59.385243">97°41.0&apos;W</word>
    <word xMin="21.813500" yMin="57.432643" xMax="38.880036" yMax="61.643743">118.6</word>
    <word xMin="274.595200" yMin="55.246143" xMax="303.050420" yMax="59.457243">97°40.5&apos;W</word>
    <word xMin="21.813500" yMin="64.631043" xMax="65.387580" yMax="68.842143">GEORGETOWN</word>
    <word xMin="66.931884" yMin="64.631043" xMax="88.891886" yMax="68.842143">TOWER</word>
    <word xMin="258.143400" yMin="67.322003" xMax="272.615479" yMax="72.505103">820</word>
    <word xMin="21.813500" yMin="71.829543" xMax="45.960298" yMax="76.040643">120.225</word>
    <word xMin="21.813500" yMin="79.027943" xMax="35.796365" yMax="83.239043">GND</word>
    <word xMin="37.410269" yMin="79.027943" xMax="51.038075" yMax="83.239043">CON</word>
    <word xMin="21.813500" yMin="86.226343" xMax="42.420401" yMax="90.437443">119.12</word>
    <word xMin="41.280400" yMin="86.226343" xMax="45.959400" yMax="90.437443">5</word>
    <word xMin="163.878259" yMin="117.018855" xMax="168.001991" yMax="123.341700">VA</word>
    <word xMin="165.734459" yMin="113.853216" xMax="168.973591" yMax="117.293900">R</word>
    <word xMin="167.283759" yMin="108.805556" xMax="170.522891" yMax="112.246200">3</word>
    <word xMin="168.082659" yMin="106.202846" xMax="171.321791" yMax="109.643400">.</word>
    <word xMin="168.482059" yMin="102.298756" xMax="172.520091" yMax="108.342200">6°</word>
    <word xMin="170.669359" yMin="97.775262" xMax="173.908491" yMax="101.215800">E</word>
    <word xMin="21.813500" yMin="93.424843" xMax="37.709114" yMax="97.635943">CLNC</word>
    <word xMin="39.199141" yMin="93.424843" xMax="50.785596" yMax="97.635943">DEL</word>
    <word xMin="21.813500" yMin="100.623343" xMax="45.960298" yMax="104.834443">119.125</word>
    <word xMin="21.813500" yMin="107.821743" xMax="36.852391" yMax="112.032843">121.1</word>
    <word xMin="38.523379" yMin="107.821743" xMax="56.710411" yMax="112.032843">(When</word>
    <word xMin="58.381399" yMin="107.821743" xMax="75.826512" yMax="112.032843">Tower</word>
    <word xMin="77.497500" yMin="107.821743" xMax="98.291273" yMax="112.032843">Closed)</word>
    <word xMin="220.538525" yMin="127.097852" xMax="227.130300" yMax="131.308974">1</word>
    <word xMin="217.005725" yMin="126.879352" xMax="223.597500" yMax="131.090474">8</word>
    <word xMin="203.290100" yMin="135.150543" xMax="216.708218" yMax="139.361643">ELEV</word>
    <word xMin="133.478800" yMin="139.908043" xMax="162.915174" yMax="144.119143">JANUARY</word>
    <word xMin="164.492348" yMin="139.908043" xMax="177.109739" yMax="144.119143">2020</word>
    <word xMin="231.049200" yMin="136.713226" xMax="241.936339" yMax="141.194717">A1</word>
    <word xMin="204.441900" yMin="142.349143" xMax="216.199993" yMax="146.560243">786</word>
    <word xMin="232.301100" yMin="146.376926" xMax="238.892114" yMax="150.587917">B</word>
    <word xMin="116.328600" yMin="147.394543" xMax="141.709401" yMax="151.605643">ANNUAL</word>
    <word xMin="143.212647" yMin="147.394543" xMax="158.912545" yMax="151.605643">RATE</word>
    <word xMin="160.415791" yMin="147.394543" xMax="168.100383" yMax="151.605643">OF</word>
    <word xMin="169.603628" yMin="147.394543" xMax="194.653715" yMax="151.605643">CHANGE</word>
    <word xMin="228.456926" yMin="163.751141" xMax="233.335317" yMax="179.018400">179.</word>
    <word xMin="229.235506" yMin="158.452671" xMax="233.668917" yMax="166.655000">9°</word>
    <word xMin="144.809300" yMin="154.881143" xMax="155.200119" yMax="159.092243">0.1°</word>
    <word xMin="156.774486" yMin="154.881143" xMax="162.719294" yMax="159.092243">W</word>
    <word xMin="250.298816" yMin="181.670100" xMax="254.510087" yMax="190.634640">A1</word>
    <word xMin="238.358420" yMin="192.117500" xMax="242.569672" yMax="196.788252">A</word>
    <word xMin="328.761700" yMin="201.531943" xMax="357.215829" yMax="205.743043">30°41.0&apos;N</word>
    <word xMin="252.699016" yMin="241.795100" xMax="256.910287" yMax="250.759640">A1</word>
    <word xMin="28.158300" yMin="241.921943" xMax="39.916393" yMax="246.133043">789</word>
    <word xMin="28.508575" yMin="247.872800" xMax="34.519299" yMax="254.949787">11</word>
    <word xMin="226.737600" yMin="252.812926" xMax="233.328542" yMax="257.023917">D</word>
    <word xMin="203.981726" yMin="274.033758" xMax="208.860017" yMax="289.300900">5004</word>
    <word xMin="204.982726" yMin="268.735262" xMax="209.193717" yMax="273.405000">X</word>
    <word xMin="205.314826" yMin="256.396458" xMax="209.970717" yMax="268.131100">100</word>
    <word xMin="39.810000" yMin="264.797075" xMax="47.767005" yMax="270.806996">11</word>
    <word xMin="45.906900" yMin="268.394538" xMax="53.863688" yMax="274.404296">7.</word>
    <word xMin="50.479300" yMin="271.092075" xMax="58.436158" yMax="277.101996">0°</word>
    <word xMin="119.525300" yMin="270.998524" xMax="124.422908" yMax="275.209649">J</word>
    <word xMin="242.462600" yMin="266.451843" xMax="267.043662" yMax="270.662943">TENANT</word>
    <word xMin="238.959400" yMin="272.746543" xMax="268.507159" yMax="276.957643">TIE-DOWN</word>
    <word xMin="311.032800" yMin="278.979643" xMax="322.844540" yMax="283.190743">FBO</word>
    <word xMin="324.362759" yMin="278.979643" xMax="341.573284" yMax="283.190743">RAMP</word>
    <word xMin="255.758116" yMin="280.020600" xMax="259.969387" yMax="288.985240">A1</word>
    <word xMin="27.212600" yMin="279.200883" xMax="44.002324" yMax="284.059983">FIELD</word>
    <word xMin="28.209100" yMin="286.464383" xMax="43.691985" yMax="291.323483">ELEV</word>
    <word xMin="29.363400" yMin="293.727783" xMax="42.930817" yMax="298.586883">790</word>
    <word xMin="232.896020" yMin="275.139300" xMax="237.107272" yMax="279.810052">A</word>
    <word xMin="238.644400" yMin="289.280506" xMax="245.235237" yMax="293.491523">E</word>
    <word xMin="266.475600" yMin="292.080743" xMax="298.637909" yMax="296.291843">TRANSIENT</word>
    <word xMin="300.085358" yMin="292.080743" xMax="316.493636" yMax="296.291843">RAMP</word>
    <word xMin="271.028900" yMin="300.142343" xMax="300.760108" yMax="304.353443">TERMINAL</word>
    <word xMin="189.180900" yMin="304.677526" xMax="195.771958" yMax="308.888517">J</word>
    <word xMin="224.915500" yMin="306.860106" xMax="231.506558" yMax="311.071123">J</word>
    <word xMin="164.155200" yMin="308.972485" xMax="169.715104" yMax="313.183793">K</word>
    <word xMin="279.316900" yMin="307.907743" xMax="293.076983" yMax="312.118843">TWR</word>
    <word xMin="230.155520" yMin="324.312000" xMax="234.366772" yMax="328.982752">A</word>
    <word xMin="140.878300" yMin="325.697175" xMax="148.835205" yMax="331.707196">40</word>
    <word xMin="146.975239" yMin="329.294544" xMax="154.932105" yMax="335.304396">99</word>
    <word xMin="154.596000" yMin="333.790775" xMax="159.504580" yMax="338.002096">X</word>
    <word xMin="159.147200" yMin="336.476075" xMax="167.104205" yMax="342.485996">75</word>
    <word xMin="243.978100" yMin="324.868643" xMax="253.127136" yMax="329.079743">HS</word>
    <word xMin="254.916853" yMin="324.868643" xMax="258.496288" yMax="329.079743">1</word>
    <word xMin="235.200400" yMin="341.535926" xMax="241.791361" yMax="345.746917">F</word>
    <word xMin="216.646900" yMin="351.736043" xMax="228.458640" yMax="355.947143">FBO</word>
    <word xMin="229.976859" yMin="351.736043" xMax="247.187384" yMax="355.947143">RAMP</word>
    <word xMin="291.362930" yMin="393.634555" xMax="295.574047" yMax="397.677300">M</word>
    <word xMin="291.630801" yMin="403.604113" xMax="297.641525" yMax="410.681100">29</word>
    <word xMin="247.312906" yMin="361.408943" xMax="251.523923" yMax="365.785300">L</word>
    <word xMin="271.336200" yMin="360.639445" xMax="276.116500" yMax="364.850806">F</word>
    <word xMin="265.131000" yMin="381.468575" xMax="273.087788" yMax="387.478496">0.</word>
    <word xMin="269.703400" yMin="384.166375" xMax="277.660056" yMax="390.176296">7%</word>
    <word xMin="278.009900" yMin="389.067375" xMax="286.446795" yMax="395.360596">UP</word>
    <word xMin="263.326400" yMin="396.027475" xMax="271.283305" yMax="402.037396">29</word>
    <word xMin="269.423300" yMin="399.624675" xMax="277.380088" yMax="405.634596">7.</word>
    <word xMin="273.995700" yMin="402.322475" xMax="281.952558" yMax="408.332396">0°</word>
    <word xMin="300.399200" yMin="404.450043" xMax="313.817318" yMax="408.661143">ELEV</word>
    <word xMin="301.550900" yMin="411.648643" xMax="313.308993" yMax="415.859743">759</word>
    <word xMin="331.713100" yMin="420.710343" xMax="360.167229" yMax="424.921443">30°40.5&apos;N</word>
    <word xMin="43.215733" yMin="456.315943" xMax="61.985747" yMax="460.527043">S-12.5</word>
    <word xMin="27.212500" yMin="464.234243" xMax="42.504874" yMax="468.445343">RWY</word>
    <word xMin="44.143577" yMin="464.234243" xMax="59.435951" yMax="468.445343">18-36</word>
    <word xMin="42.737773" yMin="472.152543" xMax="57.497132" yMax="476.363643">S-30,</word>
    <word xMin="59.222163" yMin="472.152543" xMax="73.401912" yMax="476.363643">D-60</word>
    <word xMin="209.092726" yMin="469.331541" xMax="213.971017" yMax="484.598800">359.</word>
    <word xMin="209.871206" yMin="464.033071" xMax="214.304717" yMax="472.235400">9°</word>
    <word xMin="27.212500" yMin="448.397543" xMax="42.504874" yMax="452.608643">RWY</word>
    <word xMin="44.143577" yMin="448.397543" xMax="59.435951" yMax="452.608643">11-29</word>
    <word xMin="231.100134" yMin="450.726054" xMax="235.311378" yMax="455.392300">L</word>
    <word xMin="217.255400" yMin="426.549826" xMax="223.846342" yMax="430.760817">G</word>
    <word xMin="192.319926" yMin="464.446841" xMax="196.753417" yMax="472.649100">0.</word>
    <word xMin="192.653606" yMin="459.148477" xMax="197.087117" yMax="467.350700">8%</word>
    <word xMin="193.259806" yMin="448.966564" xMax="197.728217" yMax="457.725100">UP</word>
    <word xMin="5.000000" yMin="238.266113" xMax="12.812000" yMax="256.159180">SC-3,</word>
    <word xMin="5.000000" yMin="260.048828" xMax="12.812000" yMax="267.834961">27</word>
    <word xMin="5.000000" yMin="269.779785" xMax="12.812000" yMax="283.003906">JAN</word>
    <word xMin="5.000000" yMin="284.948730" xMax="12.812000" yMax="300.520996">2022</word>
    <word xMin="5.000000" yMin="304.410645" xMax="12.812000" yMax="310.248535">to</word>
    <word xMin="5.000000" yMin="314.138184" xMax="12.812000" yMax="321.924316">24</word>
    <word xMin="5.000000" yMin="323.869141" xMax="12.812000" yMax="337.482910">FEB</word>
    <word xMin="5.000000" yMin="339.427734" xMax="12.812000" yMax="355.000000">2022</word>
    <word xMin="232.332700" yMin="234.319143" xMax="241.481736" yMax="238.530243">HS</word>
    <word xMin="243.271453" yMin="234.319143" xMax="246.850888" yMax="238.530243">2</word>
    <word xMin="27.243000" yMin="234.723443" xMax="40.661118" yMax="238.934543">ELEV</word>
    <word xMin="180.470600" yMin="486.657943" xMax="193.888718" yMax="490.869043">ELEV</word>
    <word xMin="181.694300" yMin="493.856543" xMax="193.452393" yMax="498.067643">748</word>
    <word xMin="197.213200" yMin="499.521226" xMax="203.804975" yMax="503.732348">3</word>
    <word xMin="200.746000" yMin="499.739726" xMax="207.337775" yMax="503.950848">6</word>
    <word xMin="25.484800" yMin="524.708663" xMax="55.802606" yMax="529.243763">CAUTION:</word>
    <word xMin="57.389261" yMin="524.708663" xMax="65.500242" yMax="529.243763">BE</word>
    <word xMin="67.086897" yMin="524.708663" xMax="87.535709" yMax="529.243763">ALERT</word>
    <word xMin="89.122364" yMin="524.708663" xMax="97.582409" yMax="529.243763">TO</word>
    <word xMin="99.169064" yMin="524.708663" xMax="127.722510" yMax="529.243763">RUNWAY</word>
    <word xMin="129.309165" yMin="524.708663" xMax="160.693203" yMax="529.243763">CROSSING</word>
    <word xMin="162.279858" yMin="524.708663" xMax="205.474957" yMax="529.243763">CLEARANCES.</word>
    <word xMin="58.382500" yMin="532.339163" xMax="92.687508" yMax="536.874263">READBACK</word>
    <word xMin="94.246827" yMin="532.339163" xMax="102.218063" yMax="536.874263">OF</word>
    <word xMin="103.777382" yMin="532.339163" xMax="115.902643" yMax="536.874263">ALL</word>
    <word xMin="117.461961" yMin="532.339163" xMax="145.523458" yMax="536.874263">RUNWAY</word>
    <word xMin="147.082776" yMin="532.339163" xMax="175.487323" yMax="536.874263">HOLDING</word>
    <word xMin="177.046642" yMin="532.339163" xMax="222.092236" yMax="536.874263">INSTRUCTIONS</word>
    <word xMin="223.651554" yMin="532.339163" xMax="229.196491" yMax="536.874263">IS</word>
    <word xMin="230.755810" yMin="532.339163" xMax="263.844549" yMax="536.874263">REQUIRED.</word>
    <word xMin="18.214200" yMin="554.663542" xMax="63.754141" yMax="562.696942">AIRPORT</word>
    <word xMin="66.415428" yMin="554.663542" xMax="117.267298" yMax="562.696942">DIAGRAM</word>
    <word xMin="18.214200" yMin="564.834543" xMax="37.051854" yMax="569.045643">21224</word>
    <word xMin="305.577400" yMin="553.316843" xMax="349.844816" yMax="557.527943">GEORGETOWN,</word>
    <word xMin="351.359994" yMin="553.316843" xMax="370.887597" yMax="557.527943">TEXAS</word>
    <word xMin="258.129900" yMin="562.165643" xMax="320.687983" yMax="567.996743">GEORGETOWN</word>
    <word xMin="322.905097" yMin="562.165643" xMax="373.152746" yMax="567.996743">MUNI(GTU)</word>
    <word xMin="374.247985" yMin="337.106934" xMax="382.059985" yMax="355.000000">SC-3,</word>
    <word xMin="374.247985" yMin="325.431152" xMax="382.059985" yMax="333.217285">27</word>
    <word xMin="374.247985" yMin="310.262207" xMax="382.059985" yMax="323.486328">JAN</word>
    <word xMin="374.247985" yMin="292.745117" xMax="382.059985" yMax="308.317383">2022</word>
    <word xMin="374.247985" yMin="283.017578" xMax="382.059985" yMax="288.855469">to</word>
    <word xMin="374.247985" yMin="271.341797" xMax="382.059985" yMax="279.127930">24</word>
    <word xMin="374.247985" yMin="255.783203" xMax="382.059985" yMax="269.396973">FEB</word>
    <word xMin="374.247985" yMin="238.266113" xMax="382.059985" yMax="253.838379">2022</word>
    <word xMin="289.865900" yMin="218.240043" xMax="301.677640" yMax="222.451143">FBO</word>
    <word xMin="303.195859" yMin="218.240043" xMax="320.406384" yMax="222.451143">RAMP</word>
    <word xMin="245.639600" yMin="218.769806" xMax="252.230614" yMax="222.980823">C</word>
  </page>
</doc>
</body>
</html>

:findLatitudeTextBoxes2
$VAR1 = {};
Found 0 Potential latitude text boxes

:findLongitudeTextBoxes2
LonRegex3: Degrees: ., minutes: 6, declination: E && 98, airportLongitudeDeclination, W
Argument "." isn't numeric in abs at ./georeference_airport_diagrams_via_db.pl line 1680.
$VAR1 = {};
Found 0 Potential longitude text boxes

:findClosestLineToTextBox
latitudeTextBoxes
$VAR1 = {};
:findClosestLineToTextBox
longitudeTextBoxes
$VAR1 = {};
findIntersectionOfLatLonLines
$VAR1 = {};
Ground Control Points command line string

Found 0 potential Ground Control Points
Only found 0 ground control points in plates/05724AD.PDF, can't georeference
Touching plates/noPoints-TX-GTU-05724AD-PDF-AIRPORT-DIAGRAM.vrt
Success: 0, Fail: 0, No Text: 0, No Points: 1, Chart: 1/1
ssokol commented 2 years ago

Got a bit further by fixing the issue with the stream count function. Apparently something has changed in the way mutool works. I was able to get the number of streams by revising the function as:

sub getNumberOfStreams {

    #Get number of objects/streams in the targetpdf

    my $_mutoolShowOutput = qx(mutool show $main::targetPdf trailer/Size);
    if ($debug) {
            say "mutools show output: " . $_mutoolShowOutput;
    }
    my $retval            = $? >> 8;
    die "No output from mutool show.  Is it installed? Return code was $retval"
      if ( $_mutoolShowOutput eq "" || $retval != 0 );

    my $_objectstreams;

    foreach my $line ( split /[\r\n]+/, $_mutoolShowOutput ) {
        ## Regular expression magic to grab what you want
        if ($debug) {
                say "Line: " . $line;
        }
        if ($line =~ /^(\d+)$/ ) {
                $_objectstreams = $1;
        }
        if ( $line =~ /^(\d+)\s+(\d+)$/ ) {
            $_objectstreams = $2;
        }
    }
    if ($debug) {
        say "Object streams: " . $_objectstreams;
    }
    return $_objectstreams;
}

Once that was fixed, it was able to create the .vrt files. I'm not seeing where it updated the PDF with the corner information, but perhaps it never did that?

JanC commented 2 years ago

Hi @ssokol

I beleive your issue is similar to the one I opened some years ago.

https://github.com/jlmcgraw/GeoReferencePlates/issues/2

In one of my comments I also mention the regex that does not seem to be matching anymore.

Unfortunately I gave up on trying to fix it and it seems @jlmcgraw is not maintaining this repo anymore.

ssokol commented 2 years ago

Hi @JanC

I have not run a full test, but the fix I added to getNumberOfStreams() seems to have made it work properly for me. It is now finding the ground control points and creating the .vrt files as expected. I suspect it is able to use data from the streams rather than from the raw text dump (not sure - have not dug that far into it).

I'll run a full test later today and if it works I'll fork the repo and post the fixed version. At some point it might be fun to recreate this in some more modern language - either Go (my current go-to) or Python.

Cheers,

-S

JanC commented 2 years ago

that's great!

Yeah a Python would be definitely more maintainable but I think that would be a lot a work

ssokol commented 2 years ago

Just ran a limited test on US FAA airport diagrams for the state of Texas (where I'm based). With my changes to the getNumberOfStreams() function the georeference_airport_diagrams_via_db.pl script works with a number of exceptions:

  1. It fails on files that do not contain text information. So far as I've found, these are all plates provided by the US military for military-only or joint-use airports. The files generally contain the necessary information in raster form (i.e. in the "image" component of the .pdf) but not in metadata. The files also do not contain discrete streams with the necessary line and icon data. It may be possible to manually georeference, but I've not done any testing to see if these are to scale.

  2. It fails on files in which the diagram is rotated to fit (i.e. where the diagram is a landscape image). The georeference process appears to work properly. The system identifies control points and is able to generate the .vrt files. However, the check process fails the result. I've not checked (yet) to see if the output could still be used with just a change in the order of the corner values.

  3. It occasionally (only once that I found) fails when it is not able to find enough control points. The APD for AUS (Austin Bergstrom Intl.) failed this way and I was able to correct it by manually adding a control point.

Given my requirements, I don't need to worry about the exclusively military airports as my users won't be landing there except in emergency situations (and in those cases, they can probably get progressive taxi assistance). The cases I do need to address are the few joint-use airports (i.e. airports that are shared by a civil operator and a military operator), the failures due to orientation, and the oddball failures due to control point capture issues.

Fortunately, airport diagrams don't change all that often. The few that won't automatically process can be reviewed quickly enough for changes.