<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Surely there is an “all of Norway” planar projection you can use to handle the integrative whole-country work cases? Even if there isn’t, you can always invent one and add it to the spatial_ref_sys table. <div class=""><br class=""></div><div class="">P<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 7, 2019, at 3:02 AM, Lars Aksel Opsahl <<a href="mailto:Lars.Opsahl@nibio.no" class="">Lars.Opsahl@nibio.no</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">Hi</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">We have one issue/problem and that is how to handle Tolerance/SnapTo in a good way when working in degrees.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">We work on maps that covers all of Norway so we use degrees<span class="Apple-converted-space"> </span><a href="https://epsg.io/4258" class="">https://epsg.io/4258</a><span class="Apple-converted-space"> </span>. We also use Postgis Topology, which means that we just have add new lines both for surface and line layers and let Postgis Topology take care generating the surfaces so this samples I just focus on lines.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">A description and some code pieces to illustrate the problem:</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><b class="">A: Layers in meter </b></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">First we show that this works well when working in meter. I create a Postgis Topology layer with layer_precision 10 meter using<span class="Apple-converted-space"> </span><a href="https://epsg.io/25833" class="">https://epsg.io/25833</a>. Then we add 4 horizontal lines and 4 vertical lines using a precision with 2 meter. Postgis Topology handles this nicely and we end with total of 4 lines and not 8 lines as we added, because every second line snaps to the line added before because the distance between the lines are less 2 meter which use as precision we used when adding new lines.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">The sample code :<a href="https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_meter.sql" id="LPlnk90327" class="OWAAutoLink" previewremoved="true">https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_meter.sql</a></div><br class=""><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">A image of the result :<a href="https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_meter.png" id="LPlnk302956" class="OWAAutoLink" previewremoved="true">https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_meter.png</a></div><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">The green lines are the lines we added, the red lines are the lines that are stored in the edge table.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><b class="">Layers in degrees :</b></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">But when we are using degrees things starts be more difficult. The reason why we are using degrees is to get a accurate transformations to local UTM zones which are different depending on where in Norway you are.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">So the problem is how to use tolerances so we get a behavior equal to the test using meter.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">We can we define the layer in Postgis Topology with quite big value because this is just max value as it seems. So we can adjust the tolerance parameter as we add lines but the problem is that we need to adjust this parameter depending on where we are and what orientation the line has. For vertical lines we need a bigger tolerance than for horizontal lines in Norway. This makes it quite complicated to handle adding new lines.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">The sample code :<a href="https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_degrees.sql" id="LPlnk421152" class="OWAAutoLink" previewremoved="true">https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_degrees.sql</a></div><br class=""><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">A image of the result :<a href="https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_degrees.png" id="LPlnk419200" class="OWAAutoLink" previewremoved="true">https://github.com/NibioOpenSource/pgtopo_update_sql/blob/develop/src/test/sql/snapto/snapto_code_example_degrees.png</a></div><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">The green lines are the lines we added, the red lines are the lines that are stored in the edge table.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">It real life it's impossible to do it this because water, farm land are not built up by horizontal and vertical lines only. Since we use Postgis Topology we could split a line in the different line parts and based on the angle select the best tolerance value but that is complicated and means extra computing. Another problem is that edges then will be broken up into unnecessary small pieces.</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">Any ideas on how to handle this in a better way ?</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">Can “PostGIS Geography Type” help us here ?</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class="">Thanks Lars</div><div style="margin-top: 0px; margin-bottom: 0in; font-family: -webkit-standard;" class=""><br class=""></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">postgis-users mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:postgis-users@lists.osgeo.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">postgis-users@lists.osgeo.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></div></blockquote></div><br class=""></div></body></html>