<div dir="ltr"><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Hi Darafei, dear all,</span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Thanks, but I still cannot get this to work.</span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">I've now calculated real_scale = mapnik_scale / cos(lat), and used the real_scale, to calculate:</span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-size:12.8px">pixels * (72/2.54 pixels/cm) * real_scale = real_world_dim</span><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">However, there's still a latitude-dependent discrepancy (see below). I could try to fit that to latitude, to see what the formula is, but I'm hoping somebody has the answer (or can let me know what I got wrong!)</span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Happy new year!</span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Bjoern</span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><b>Example 1:</b></span></div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><a href="http://www.openstreetmap.org/#map=13/24.1788/49.3092">http://www.openstreetmap.org/#map=13/24.1788/49.3092</a></span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">bbox = [24.123255,49.250507; 24.234286,49.367924]</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">bbox size in degrees (lon, lat) = 0.117416, 0.111031</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><b style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Pixels ('Image ... at'):</b><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"> 1945 x 2016; </span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><b>mapnik_scale</b> 1 : 24000; <b>real scale </b>1 : 26308</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Image dim (1 : 26308, 72dpi): 686 mm x 711 mm</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (1:1, from pixels): <b>18.051 km x 18.71 km</b></span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (1:1, latlon): <b>11.911 km x 12.346 km</b></span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Ratio (dim pixels/ dim latlon): 1.516 ; 1.515</span><br><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><b style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Example 2:</b><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><a href="http://www.openstreetmap.org/#map=13/48.6617/-101.3104">http://www.openstreetmap.org/#map=13/48.6617/-101.3104</a></span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">bbox = [48.632228,-101.369133; 48.691074,-101.251717]</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">bbox size in degrees (lon, lat) = 0.117416, 0.058846</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><b style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Pixels ('Image ... at'):</b><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"> 1945 x 1476; </span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><b>mapnik_scale</b> 1 : 24000; <b>real scale </b>1 : 36336</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Image dim (1 : 36336, 72dpi): 686 mm x 521 mm</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (1:1, from pixels): <b>24.932 km x 18.92 km</b></span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (1:1, latlon):<b> 8.624 km x 6.543 km</b></span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Ratio (dim pixels/ dim latlon): 2.891 ; 2.891</span><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 31 December 2017 at 18:59, Darafei "Komяpa" Praliaskouski <span dir="ltr"><<a href="mailto:me@komzpa.net" target="_blank">me@komzpa.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Images are in Spherical Mercator EPSG:3857 projection, so linear scale is off by cos(lat). </p>
<br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Sun, Dec 31, 2017, 20:07 Bjoern Hassler <<a href="mailto:bjohas%2Bmw@gmail.com" target="_blank">bjohas+mw@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Dear friends,<div><br></div><div>I'm trying to make sense of the scales for map images downloaded from OSM. For the download, you can choose the scale, and I had assumed that I could use this to convert to an actual map scale. </div><div><br></div><div>The downloaded png/jpg etc seem to be at 72dpi. I had assumed I could just convert pixels at 72dpi to actual dimensions (using the scale).</div><div><br></div><div>However - as far as I can tell - this doesn't work. Maybe I've made a mistake somewhere, but the dimensions calculated from</div><div><ul><li>"feature in pixels" / (72/2.54 pixels/cm) * scale = "feature size" in cm<br></li><li>lat-lon (e.g. bounding box provided)</li></ul><div>Doesn't match. Moreover, the difference doesn't seem to be a constant offset or ratio, but possibly latitude dependent. </div><div><br></div><div>Maybe the scale offered during download is not meant to be a geographic scale? Maybe I've misunderstood something?</div></div><div> </div><div>There are two worked examples below, that show the issue.</div><div><br></div><div>Any thoughts?</div><div>Bjoern</div><div><br></div><div>(and a Happy New Year!!)</div><div><br></div><div><br></div><div><b>Example 1:</b></div><div><br></div><div>I had a look for long straight roads ... (Trivia: <a href="http://www.dangerousroads.org/rankings23/3759-the-10-longest-straight-roads-in-the-world.html" target="_blank">http://www.<wbr>dangerousroads.org/rankings23/<wbr>3759-the-10-longest-straight-<wbr>roads-in-the-world.html</a> - "Located in the heart of Saudi Arabia, the Highway 10  is 120 miles (193km) stretch of straightness. This asphalted road links Haradh and Al Batha. It’s a straight road running right through the desert for 2 h 1 min.")</div><div><br></div><div><div>- Open 'share', </div><div>- set scale to 1:50000,</div><div>- adjust view port so that "Image will show standard layer at 932x..."</div></div><div>- Go here: <a href="http://www.openstreetmap.org/#map=13/24.1349/49.3083" target="_blank">http://www.openstreetmap.org/#<wbr>map=13/24.1349/49.3083</a></div><div><div><div><br></div><div>On the map, there's a road (East/West), with two turn-off: First, a power line at the Eastern edge (running North/South). In the west, there are two turn-off, the second (straight one) being 11.9 km from the power line (according to JOSM). In the image, you've got those right at the edges. From the bounding box (hidden fields), I calculate 11.62km. Given that the roads are just showing either side of the image, that's bang on.</div></div><div><div><br></div></div><div><div>Now download PNG, which will have with 932. I am assuming I have a PNG (72dpi = 28.35 dots per cm), at scale 1:50,000. I calculate:</div></div><div><br></div><div>932 pixels / (72/2.54 pixels/cm) * 50000 = 16.4 km.<br></div><div><br></div><div>So there's a difference between the dimensions calculated from the pixels and the distance calculated from lat/lon.</div><div><br></div><div><b>Full details for Example 1:</b></div><div><br></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Z/L/L #13/24.1727/49.3090</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">bbox = [24.119651808471247,49.<wbr>249992370605476 -> 24.22567631717543,49.<wbr>368095397949226]</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Pixel dim:</span><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"> 939 x 924; </span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Natural image dim (72dpi): 331 mm x 326 mm, 1 : 50000</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (from pixels): 16.563 km x 16.298 km, 1 : 1</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (latlon): 11.981 km x 11.789 km, 1 : 1</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Ratio: 1.382438861530757 ; 1.3824751887352615</span><br></div><div><br></div><div><b>Example 2:</b></div></div><div><br></div><div>Another example from the above list:</div><div><br></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Z/L/L #13/48.6536/-101.3485</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">bbox = [48.615207636211146,-101.<wbr>44741058349611 -> 48.69198023486001,-101.<wbr>24965667724611]</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Pixel dim:</span><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"> 1572 x 924; </span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Natural image dim (72dpi): 555 mm x 326 mm, 1 : 50000</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (from pixels): 27.728 km x 16.298 km, 1 : 1</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Real world dim (latlon): 14.526 km x 8.537 km, 1 : 1</span><br style="box-sizing:border-box;font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">Ratio: 1.908853091009225 ; 1.909101557924329</span><br></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px"><br></span></div><div><span style="font-family:"Helvetica Neue",Arial,sans-serif;font-size:12px">The distance (along the highway) from the turnoffs to Undip / Lansford airstrips is 8.1km in JOSM. So the latlon calculation is correct. However, the dimension calculated from the pixels isn't.</span></div></div></div></div>
______________________________<wbr>_________________<br>
dev mailing list<br>
<a href="mailto:dev@openstreetmap.org" target="_blank">dev@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/dev" rel="noreferrer" target="_blank">https://lists.openstreetmap.<wbr>org/listinfo/dev</a><br>
</blockquote></div>
</blockquote></div><br></div>