<div dir="ltr">Dear friends,<div><br></div><div>I was just wondering whether anybody else had any thoughts on this? Any tips on making sense of the mapnik_scale would be greatly appreciated!</div><div><br></div><div>Bjoern</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 3 January 2018 at 17:21, Bjoern Hassler <span dir="ltr"><<a href="mailto:bjohas+mw@gmail.com" target="_blank">bjohas+mw@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Bryan, hi Darafei,<div><br></div><div>That's helpful, thanks. So we know that the calculation from the bbox is correct.</div><div><br></div><div>However, I guess we don't know about how pixels translate to real-word dims? (Or, equicvalenly, how pixels relate to the lat-lon extent.)</div><div><br></div><div>Thanks!</div><span class="HOEnZb"><font color="#888888"><div>Bjoern</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 2 January 2018 at 14:46, Bryan Housel <span dir="ltr"><<a href="mailto:bryan@7thposition.com" target="_blank">bryan@7thposition.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div>Bjoern, maybe the geo functions used in iD might be a helpful reference:</div><div><a href="https://github.com/openstreetmap/iD/blob/master/modules/geo/geo.js" target="_blank">https://github.com/openstreetm<wbr>ap/iD/blob/master/modules/geo/<wbr>geo.js</a></div><div><br></div><div>The numbers I got from comparing the bbox sizes are pretty close to your numbers.</div><div><br></div><div><br></div><div>bbox1 = [[24.123255,49.250507], [24.234286,49.367924]]</div><div><br></div><div><div>dLat1 = bbox1[1][0] - bbox1[0][0] </div><div>> 0.11103100000000055</div><div>iD.geoLatToMeters(dLat1)</div><div>> 12359.91438226802</div></div><div>dLon1 = bbox1[1][1] - bbox1[0][1] </div><div><div>> 0.11741700000000321</div></div><div><div><div>iD.geoLonToMeters(dLon1, (bbox1[1][0] + bbox1[0][0])/2)</div><div>> 11884.145336433623</div></div></div><div><br></div><div>(image1 is 11.884 km x 12.359 km)</div><div><div><br></div><div><br></div><div>bbox2 = [[48.632228,-101.369133], [48.691074,-101.251717]]</div></div><div><br></div><div><div>dLat2 = bbox2[1][0] - bbox2[0][0] </div><div>> 0.05884600000000262</div><div>iD.geoLatToMeters(dLat2)</div><div>> 6550.706755221268</div></div><div><div>dLon2 = bbox2[1][1] - bbox2[0][1] </div><div>> 0.11741600000000574</div><div>iD.geoLonToMeters(dLon2, (bbox2[1][0] + bbox2[0][0])/2)</div><div>> 8604.30156213755</div></div><div><br></div><div><div>(image2 is 8.604 km x 6.550 km)</div></div><span class="m_-2691928519732351576HOEnZb"><font color="#888888"><div><br></div><div><br></div>Bryan</font></span><div><div class="m_-2691928519732351576h5"><div><br><div><br><div><br><blockquote type="cite"><div>On Jan 1, 2018, at 6:56 AM, Bjoern Hassler <<a href="mailto:bjohas+mw@gmail.com" target="_blank">bjohas+mw@gmail.com</a>> wrote:</div><br class="m_-2691928519732351576m_8038064052635115234Apple-interchange-newline"><div><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" target="_blank">http://www.openstreetmap.org/#<wbr>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" target="_blank">http://www.openstreetmap.org/#<wbr>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="m_-2691928519732351576m_8038064052635115234h5"><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="m_-2691928519732351576m_8038064052635115234h5"><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.dangerousr<wbr>oads.org/rankings23/3759-the-1<wbr>0-longest-straight-roads-in-th<wbr>e-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.2499923<wbr>70605476 -> 24.22567631717543,49.368095397<wbr>949226]</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.44741<wbr>058349611 -> 48.69198023486001,-101.2496566<wbr>7724611]</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.or<wbr>g/listinfo/dev</a><br>
</blockquote></div>
</blockquote></div><br></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" target="_blank">https://lists.openstreetmap.or<wbr>g/listinfo/dev</a><br></div></blockquote></div><br></div></div></div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>