<div dir="ltr">I included as much detail as I could. I put links to all images because I wasn't sure they would embed in the email list. Experienced programmer but brand new to gdal.<div><br></div><div>Overview: My drone is taking multiple high resolution images that slightly overlap each other in order to view 1 large high resolution image with great detail after they are put together. I want to superimpose those images in google maps as a super-overlay. It is a large area being imaged and there can be from 800 to 1500 images. I am trying to follow these instructions: </div><a href="https://developers.google.com/kml/articles/raster#step-3:-get-information-about-the-image">https://developers.google.com/kml/articles/raster#step-3:-get-information-about-the-image</a><div><br></div><div>I am using python3 3.6.8 and gdal 2.4.0 on ubuntu.<br><div><br><div>My plan is to execute gdal2tiles for each of these images that will compose the 'single' large image to be super-overlayed in google maps (using javascript).</div><div><br></div><div>These are the steps I took using this image downloaded locally:</div><div><a href="https://s3.amazonaws.com/app-dev.mydroneop.com/DJI_0001.JPG">https://s3.amazonaws.com/app-dev.mydroneop.com/DJI_0001.JPG</a><br></div><div><br></div><div>1. I run this command:</div><div>>gdalinfo DJI_0001.JPG -json </div><div>(the full output of this command is here: <a href="https://s3.amazonaws.com/app-dev.mydroneop.com/gdalinfo-output.json">https://s3.amazonaws.com/app-dev.mydroneop.com/gdalinfo-output.json</a>)</div><div><br></div><div>But as I understand it the important part is this:</div><div><br></div><div>"cornerCoordinates":{<br>    "upperLeft":[<br>      0.0,<br>      0.0<br>    ],<br>    "lowerLeft":[<br>      0.0,<br>      3648.0<br>    ],<br>    "lowerRight":[<br>      5472.0,<br>      3648.0<br>    ],<br>    "upperRight":[<br>      5472.0,<br>      0.0<br>    ],<br>    "center":[<br>      2736.0,<br>      1824.0<br>    ]<br>  }<br></div><div><br></div><div>2. I then run this command and it produces this file: </div><div><a href="https://s3.amazonaws.com/app-dev.mydroneop.com/output.vrt">https://s3.amazonaws.com/app-dev.mydroneop.com/output.vrt</a><br></div><div>> gdal_translate -of VRT -a_srs EPSG:4326 -gcp 0 0 -180 90 -gcp 5472 0 180 90 -gcp 5472 3648 180 -90 DJI_0001.JPG output.vrt</div><div><br></div><div>The -180 90 and 180 90 does not seem right, does not seem those should not be variable specific to the images long/lat in some way.</div><div><br></div><div>3. Then I run this command:</div><div>gdalwarp -of VRT -t_srs EPSG:4326 output.vrt output2.vrt<br></div><div>and it produces this file:</div><div><a href="https://s3.amazonaws.com/app-dev.mydroneop.com/output2.vrt">https://s3.amazonaws.com/app-dev.mydroneop.com/output2.vrt</a><br></div><div><br></div><div>4. Then finally I run this command:</div><div>gdal2tiles.py -p geodetic -k output2.vrt<br></div><div>and it produces a folder of sub folders with images, but here is the doc file is produces:</div><div><a href="https://s3.amazonaws.com/app-dev.mydroneop.com/tiles/doc.kml">https://s3.amazonaws.com/app-dev.mydroneop.com/tiles/doc.kml</a><br></div><div>The other files (images and kmls) are accessible relative to that file's location if you need to see them.</div><div><br></div><div>I then build a basic web page consuming googlemaps and 'import' the kml file like this:</div><div><br></div><div>======START HTML=======</div><div><pre style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style="background-color:rgb(239,239,239)"><</span><span style="color:rgb(0,0,128);background-color:rgb(239,239,239);font-weight:bold">script </span><span style="color:rgb(0,0,255);background-color:rgb(239,239,239);font-weight:bold">async defer<br></span><span style="color:rgb(0,0,255);background-color:rgb(239,239,239);font-weight:bold">        src=</span><span style="color:rgb(0,128,0);background-color:rgb(239,239,239);font-weight:bold">"<a href="https://maps.googleapis.com/maps/api/js?key=GOOGLE_MAPS_KEY&callback=initMap">https://maps.googleapis.com/maps/api/js?key=GOOGLE_MAPS_KEY&callback=initMap</a>"</span><span style="background-color:rgb(239,239,239)">></</span><span style="color:rgb(0,0,128);background-color:rgb(239,239,239);font-weight:bold">script</span><span style="background-color:rgb(239,239,239)">></span></pre><pre style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style="color:rgb(0,0,128);font-weight:bold">function </span><span style="font-style:italic">initMap</span>() {<br>  <span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">map </span>= <span style="color:rgb(0,0,128);font-weight:bold">new </span>google.maps.Map(<span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">document</span>.<span style="color:rgb(122,122,67)">getElementById</span>(<span style="color:rgb(0,128,0);font-weight:bold">'map'</span>), {<br>    <span style="color:rgb(128,128,128);font-style:italic">// center: new google.maps.LatLng(43.6424359, -79.37448849999998),<br></span><span style="color:rgb(128,128,128);font-style:italic">    </span><span style="color:rgb(102,14,122);font-weight:bold">zoom</span>: <span style="color:rgb(0,0,255)">2</span>,<br>    <span style="color:rgb(102,14,122);font-weight:bold">disableDefaultUI</span>: <span style="color:rgb(0,0,128);font-weight:bold">true</span>,<br>    <span style="color:rgb(102,14,122);font-weight:bold">mapTypeId</span>: google.maps.MapTypeId.ROAD<br><br>  });<br><br>  <span style="color:rgb(0,0,128);font-weight:bold">var </span><span style="color:rgb(69,131,131)">layers </span>= [];<br>  <span style="color:rgb(69,131,131)">layers </span>[<span style="color:rgb(0,0,255)">0</span>] = <span style="color:rgb(0,0,128);font-weight:bold">new </span>google.maps.KmlLayer(<span style="color:rgb(0,128,0);font-weight:bold">"<a href="https://s3.amazonaws.com/app-dev.mydroneop.com/tiles/doc.kml">https://s3.amazonaws.com/app-dev.mydroneop.com/tiles/doc.kml</a>"</span>,{<br>    <span style="color:rgb(102,14,122);font-weight:bold">preserveViewport</span>: <span style="color:rgb(0,0,128);font-weight:bold">false</span>,<br>    <span style="color:rgb(102,14,122);font-weight:bold">map</span>: <span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">map<br></span><span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">  </span>});</pre><pre style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt">}</pre><pre style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt">======END HTML=======</pre>Full Source is here: <a href="https://s3.amazonaws.com/app-dev.mydroneop.com/index.html">https://s3.amazonaws.com/app-dev.mydroneop.com/index.html</a></div><div><br></div><div>Here is the problem and my questions:</div><div>1. I only run this on a single image while I get it to work, but the single image appears in the center of the world map and not in the long/lat associated to the image file. The image also appears stretched on it's edges. As can be seen here: </div><div><a href="https://s3.amazonaws.com/app-dev.mydroneop.com/result-zoomed-in.png">https://s3.amazonaws.com/app-dev.mydroneop.com/result-zoomed-in.png</a><br><a href="https://s3.amazonaws.com/app-dev.mydroneop.com/result-zoomed-out.png">https://s3.amazonaws.com/app-dev.mydroneop.com/result-zoomed-out.png</a><br></div><div><br></div><div>2. What am I doing wrong with the placement of the images not being at correct long lat position and rather being in the center of the world map? I assume this has something to do with the 180 90 in the gdal_translate command but don't know where to derive those numbers from if I should be deriving them.</div><div><br></div><div>3. Is it ok that I want to run gdal2tiles on each individual image that make up this large orthomosaic image that will be super-overlayed? Or should those images be stitched together and then gdal2tiles be run on the single super large image (400 mb and higher).</div><div><br></div><div>4. Why don't the images change as I zoom in? (the purpose of the tiles I thought) in my google maps html file?</div><div><br></div><div>5. In the doc.kml file, will those relative links (relative to kml file) work when the doc.kml is used in <span style="color:rgb(0,0,128);font-weight:bold">new </span>google.maps.KmlLayer('doc.kml')?</div><div><br></div><div>6. Using this command below I thought it converted x and y pixel position in the image to real world long/lat, how do I get long/lat from the command's output?:<br>> gdallocationinfo DJI_0001.JPG 10 10<br><br></div><div>Report:<br>  Location: (10P,10L)<br>  Band 1:<br>    Value: 45<br>  Band 2:<br>    Value: 75<br>  Band 3:<br>    Value: 13</div><div><br></div><div><br></div><div><br></div><div>I have searched and read many docs but can't find a sample for what I am trying to do, just pieces here and there and I haven't been able to put a complete process together. If there is somewhere that has a relatively complete explanation for what I am trying to do feel free to just point me there. </div><div><br clear="all"><div>Thank you for your patience if you read through all that, I appreciate any help that can be offered.</div><div><br></div><div>Nick</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Nick Licata<br><a href="mailto:nalicata@gmail.com" target="_blank">nalicata@gmail.com</a><br></div></div></div></div></div>