<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2014-08-01 14:24 GMT+02:00 Loic Duros <span dir="ltr"><<a href="mailto:loic.duros@gmail.com" target="_blank">loic.duros@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
When you say that osm2pgsql will reproject OSM lat/lon into web mercator, and that real distance calculation will require reprojection, do you actually mean re-importing the data in a different manner in the database, or is there a way to do the conversion on the fly with a query or using custom client code?</blockquote>
</div><br><br>By default osm2pgsql reprojects into web mercator, but you can avoid it and ask to keep the spherical coordinates if this is a better choice for your use.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
It is possible to do on the fly reprojection with postgis using ST_Transform... but this may cause a lot of calculations.</div><div class="gmail_extra">It your queries use a lot of distance calculations, you'll want to do them with real "spherical" distances, and not the projected one that is not linear. In web mercator the "distance" are pixel based, and not linear. The same "distance" will be much small at the equator compared to iceland or south africa...</div>
<div class="gmail_extra"><br clear="all"><div>You may also add a trigger in your osm2pgsql database to have 2 geometry fields, one in web mercator projection, and the other one in spherical coordinates and use the better in your queries depending on your need.</div>
<div><br></div>-- <br><div dir="ltr">Christian Quest - OpenStreetMap France</div>
</div></div>