<div style="font-family: 'verdana'; font-size: 12px; color: #000;">Hi Leopold,</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">as others mentioned, the sample image look like to be taken facing downward - like an aerial image take by a drone or veritcally from a railwagon - is this right?</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">If you just want show the images on a map and have sort of a high-resolution aerial image of the tracks, you would just need to create a world file for each JPG.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><a href="https://en.wikipedia.org/wiki/World_file" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/World_file</a></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">You say you have a location and orientation for all images - this should be sufficient to create the world files.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">You would need the coordinate of the upper left corner of the image - probably the coordinate you have in your XML is the position of the camera that has taken the image. This would be the center of the image (assuming the camera looks vertical to the ground) Together with the heading (orientation) it would be easy to calculate the position of the upper left corner, given that the distance from camera to ground is known/fixed. If the camera was mounted on a railcar the distance is fixed and should be measured. If the distance between camera and ground varies with each image, it gets complicated because ... see below.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">If location accuracy is not that important you could also take the location from the XML file directly or apply a fixed offset.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">You then need the size of a pixel of the image on the ground (<a href="https://en.wikipedia.org/wiki/Ground_sample_distance" target="_blank" rel="noopener noreferrer">https://en.wikipedia.org/wiki/Ground_sample_distance) </a>- you could measure the distance between the rails in pixels on the image - the track gauge should be known or at least easy to find out (and assume that the pixel are square). Then you get the GSD and you can calculated the left upper corner location and start filling the world file with the other parameters.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;">The rotation parmeters can then also be calculated from the orientation you have in the XML file.</span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;"> </span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;">I would advise to use a rectangular (projected) coordinate system as all calculations are much easier in [m] than in [degrees].</span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;"> </span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;">In any case the images will not match perfectly while they are distorted (which they are if they come directly from a camera). To avoid that, an elaborate process using a terrain model etc. would be necessaery - essentially the process to produce orthophotos.</span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;"> </span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;">To handle the large amount of images there are is something like virtual rasters, IIRC.</span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;"> </span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;">hth</span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;">Roland</span></div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><span style="background-color: #ffffff;"> </span></div>
<div id="sub-body-container" style="margin: 10px 5px 5px 10px; padding: 10px 0px 10px 10px; border-left: 2px solid rgb(195, 217, 229);">
<div style="margin: 0px 0px 10px;">
<div><strong>Gesendet: </strong>Mittwoch, 20. August 2025 um 16:20</div>
<div><strong>Von: </strong>"Léopold Stoessel via QGIS-User" <qgis-user@lists.osgeo.org></div>
<div><strong>An: </strong>"qgis-user@lists.osgeo.org" <qgis-user@lists.osgeo.org></div>
<div><strong>Betreff: </strong>[Qgis-user] Placing group of image at once</div>
</div>
<div class="WordSection1">
<p class="MsoNormal">Hello,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Our team is currently working on a project to reconstruct the railways of Canada using QGIS. To do this, we collect data directly on the rails, taking a photo every 2 meters. Each image (JPG) is accompanied by an XML file containing its GPS coordinates (EPSG:4326) and orientation.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Our goal is to display all the images on a QGIS map at their correct geographic location and with the proper orientation. (Example image: <em>Try.jpg</em>)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">As far as I understand, a JPG file needs either an associated PGW world file or must be converted into a georeferenced TIFF in order to be correctly placed on the map.</p>
<p class="MsoNormal">Here are the challenges we're facing:</p>
<ul style="margin-top: 0.0cm;" type="disc">
<li class="MsoNormal"><strong>PGW method</strong>: I tried placing a PNG file with a PGW of the same name in the same directory, but QGIS seems to ignore the PGW file and creates HTML document with other coordinates instead.</li>
<li class="MsoNormal"><strong>GeoTIFF method</strong>: With over 500,000 images, manually georeferencing each one is not feasible.</li>
</ul>
<p class="MsoNormal" style="margin-left: 36.0pt;"> </p>
<p class="MsoNormal">So I would like to ask for your advice:</p>
<ul style="margin-top: 0.0cm;" type="disc">
<li class="MsoNormal">Are we on the right track with our approach?</li>
<li class="MsoNormal">Which method would you recommend in our case?</li>
<li class="MsoNormal">Do you know of any way to automate the image placement and orientation based on our XML data?</li>
<li class="MsoNormal">Would it be possible to handle this through the Python console or using PyQGIS?</li>
</ul>
<p class="MsoNormal">Any guidance or suggestions would be greatly appreciated.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks in advance for your time and help!</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><strong><span style="font-size: 10.0pt; font-family: Gisha , sans-serif;"><img id="Picture_x0020_1" style="width: 6.0in; height: 0.0625in;" src="cid:image001.jpg@01DC11B7.F332C3B0" width="576" height="6" data-cid="image001.jpg@01DC11B7.F332C3B0"> </span></strong></p>
<p class="MsoNormal"><strong><span style="font-size: 4.0pt; font-family: Gisha , sans-serif;"> </span></strong></p>
<table class="MsoNormalTable" style="width: 573.75pt; border-collapse: collapse;" border="0" width="765" cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 131.85pt;">
<td style="width: 143.25pt; border: none; border-right: solid rgb(51,102,102) 1.0pt; padding: 0.0cm 5.4pt 0.0cm 5.4pt; height: 131.85pt;" valign="top" width="191">
<p class="MsoNormal"><span style="font-size: 6.0pt; font-family: Calibri , sans-serif;"> </span></p>
<p class="MsoNormal" style="text-align: center;" align="center"><a title="https://www.cefrail.ca/" href="https://www.cefrail.ca/" target="_blank" rel="noopener noreferrer"><strong><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif; color: blue; text-decoration: none;"><img id="Image_x0020_2" style="width: 1.9097in; height: 0.9513in;" src="cid:image002.png@01DC11B7.F332C3B0" width="183" height="91" border="0" data-cid="image002.png@01DC11B7.F332C3B0"></span></strong></a><a title="https://www.facebook.com/cefrail" href="https://www.facebook.com/cefrail" target="_blank" rel="noopener noreferrer"><strong><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif; color: blue; text-decoration: none;"><img id="Image_x0020_3" style="width: 0.2777in; height: 0.2777in;" src="cid:image003.png@01DC11B7.F332C3B0" width="27" height="27" border="0" data-cid="image003.png@01DC11B7.F332C3B0"></span></strong></a><strong><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif;"> </span></strong><a title="https://www.linkedin.com/authwall?trk=bf&trkInfo=AQEjKKnHH0hB2QAAAYzqp8YogvhljVV4rfWfPZk4nt7Fxp7t-jgeC03T84SUqgFnFtN8YLHip3me96M7mf832Uiq6YnFyyw3y1AU8c10Tw4twclYPuLl6KexU9lj_p4Hp_UeifI=&original_referer=&sessionRedirect=https%3A%2F%2Fwww.linkedin.com%2Fco" href="https://www.linkedin.com/authwall?trk=bf&trkInfo=AQEjKKnHH0hB2QAAAYzqp8YogvhljVV4rfWfPZk4nt7Fxp7t-jgeC03T84SUqgFnFtN8YLHip3me96M7mf832Uiq6YnFyyw3y1AU8c10Tw4twclYPuLl6KexU9lj_p4Hp_UeifI=&original_referer=&sessionRedirect=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fcefrail" target="_blank" rel="noopener noreferrer"><span style="font-size: 11.0pt; font-family: Calibri , sans-serif; color: blue; text-decoration: none;"><img id="Image_x0020_4" style="width: 0.2708in; height: 0.2708in;" src="cid:image004.png@01DC11B7.F332C3B0" width="26" height="26" border="0" data-cid="image004.png@01DC11B7.F332C3B0"></span></a></p>
</td>
<td style="width: 250.6pt; padding: 0.0cm 5.4pt 0.0cm 5.4pt; height: 131.85pt;" valign="top" width="334">
<p class="MsoNormal"><strong><span style="font-family: 'Segoe UI Light' , sans-serif;">Léopold Stoessel</span></strong></p>
<p class="MsoNormal"><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif;">Stagiaire - Génie ferroviaire</span></p>
<p class="MsoNormal"><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif;">1 866 544-RAIL</span></p>
<p class="MsoNormal"><u><span style="font-size: 11.0pt; font-family: Calibri , sans-serif; color: blue;"><a href="mailto:leopold.stoessel@cegepsi.ca" target="_blank" rel="noopener noreferrer"><span style="color: #467886;">leopold.stoessel</span><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif; color: #467886;">@cegepsi.ca</span></a></span></u><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif; color: #0e3a4f;"> </span></p>
<p class="MsoNormal"><u><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif; color: #0e3a4f;"><a href="http://www.cefrail.ca/" target="_blank" rel="noopener noreferrer"><span style="color: blue;">www.cefrail.ca</span></a> </span></u></p>
<p class="MsoNormal"><em><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif;">RAIL est un centre intégré au Cégep de Sept-Îles</span></em><span style="font-size: 10.0pt; font-family: 'Segoe UI Light' , sans-serif; color: #0e3a4f;"> </span></p>
</td>
<td style="width: 182.6pt; padding: 0.0cm 5.4pt 0.0cm 5.4pt; height: 131.85pt;" valign="top" width="243"> </td>
</tr>
</tbody>
</table>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
</div>
_______________________________________________ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-user</a> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></div>