<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello All:</p>
<p>I wrongly assumes these were oblique images. Roland raises a few
good points. If you use the same or similar cameras, and mounting
heights, then the process is relatively simple. I assume you are
not trying to create a ortho image which has vertical displacement
removed from the image (which there will be very little of
anyway). I would use the xml coordinates and calculate the top
left image coordinates based on ground sampling distance, azimuth
and image size in pixels. You can calculate the azimuth using the
rail line vector data at each image position, assuming the camera
mount for a block remains static. If you are using UTM, you will
traverse a number of zones across Canada and therefor I would also
calculate the convergence (difference between grid north and true
north for each image. This will fine tune the orientation as you
get closer to a utm zone boundary as you head east or west across
the country in your processing.</p>
<p>Depending on the camera/lens combination used, you may find a
radial distortion is an issue in the images. You can adjust for
this using a tool such as Radcor.</p>
<p>Finally, reach out to me privately and I can run your sample
image as a test. I am located in Nova Scotia.</p>
<p>Kirk Schmidt</p>
<p><a class="moz-txt-link-abbreviated" href="mailto:kirk@nortekresources.com">kirk@nortekresources.com</a><br>
</p>
<p> <br>
</p>
<p> <br>
</p>
<div class="moz-cite-prefix">On 8/26/2025 9:10 AM, Roland Spielhofer
via QGIS-User wrote:<br>
</div>
<blockquote type="cite"
cite="mid:trinity-3dd4e1fd-4b2c-404a-b7cc-5baa86fbc349-1756210228355@trinity-msg-rest-gmx-gmx-live-78b97b4557-l27pb">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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"
moz-do-not-send="true" class="moz-txt-link-freetext">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"
moz-do-not-send="true">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"
<a class="moz-txt-link-rfc2396E" href="mailto:qgis-user@lists.osgeo.org"><qgis-user@lists.osgeo.org></a></div>
<div><strong>An: </strong><a class="moz-txt-link-rfc2396E" href="mailto:qgis-user@lists.osgeo.org">"qgis-user@lists.osgeo.org"</a>
<a class="moz-txt-link-rfc2396E" href="mailto:qgis-user@lists.osgeo.org"><qgis-user@lists.osgeo.org></a></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:part1.BltEhd0f.ilX3nnuH@nortekresources.com"
data-cid="image001.jpg@01DC11B7.F332C3B0" class=""
width="576" height="6"> </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;"
width="765" cellspacing="0" cellpadding="0" border="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;"
width="191" valign="top">
<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" moz-do-not-send="true"><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:part2.g5yG0xVl.LDgzhZNz@nortekresources.com"
data-cid="image002.png@01DC11B7.F332C3B0"
class="" width="183" height="91" border="0"></span></strong></a><a
title="https://www.facebook.com/cefrail"
href="https://www.facebook.com/cefrail"
target="_blank" rel="noopener noreferrer"
moz-do-not-send="true"><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:part3.XvS1Kbrn.6F8wo25J@nortekresources.com"
data-cid="image003.png@01DC11B7.F332C3B0"
class="" width="27" height="27" border="0"></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"
moz-do-not-send="true"><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:part4.Ih1eVbAt.lBCjJn2K@nortekresources.com"
data-cid="image004.png@01DC11B7.F332C3B0"
class="" width="26" height="26" border="0"></span></a></p>
</td>
<td
style="width: 250.6pt; padding: 0.0cm 5.4pt 0.0cm 5.4pt; height: 131.85pt;"
width="334" valign="top">
<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"
moz-do-not-send="true"><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"
moz-do-not-send="true"><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;"
width="243" valign="top"> </td>
</tr>
</tbody>
</table>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
</div>
_______________________________________________ QGIS-User
mailing list <a class="moz-txt-link-abbreviated" href="mailto:QGIS-User@lists.osgeo.org">QGIS-User@lists.osgeo.org</a> List info: <a
href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
target="_blank" rel="noopener noreferrer"
moz-do-not-send="true" class="moz-txt-link-freetext">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"
moz-do-not-send="true" class="moz-txt-link-freetext">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-User mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-User@lists.osgeo.org">QGIS-User@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Kirk Schmidt, MScF, BScF, RPF
General Manager
Nortek Resource Solutions Inc.
26 Church Road
Sutherlands River, NS
B0K 1W0
Tel (902) 922.3607
Email: <a class="moz-txt-link-abbreviated" href="mailto:kirk@nortekresources.com">kirk@nortekresources.com</a>
Web: <a class="moz-txt-link-abbreviated" href="http://www.nortekresources.com">www.nortekresources.com</a></pre>
</body>
</html>