<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>liblwgeom.so is not separate anymore and liblwgeom.h is not installed either. They are all just object libraries, statically linked in all the .sos we expose as needed.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>You can take a look at <a href="https://trac.osgeo.org/postgis/ticket/4260">https://trac.osgeo.org/postgis/ticket/4260</a>  and <a href="https://github.com/postgis/postgis/pull/348/">https://github.com/postgis/postgis/pull/348/</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>where it was removed and back track those changes.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>By the way  </span><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'><a href="https://postgis.net/docs/ST_ReducePrecision.html" target="_blank">https://postgis.net/docs/ST_ReducePrecision.html</a> </span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>is a better alternative to ST_SnapToGrid as it’s much less likely to produce invalid geometries, but as mentioned only available if you have GEOS 3.9+<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Hope that helps,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Regina<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> postgis-users [mailto:postgis-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>pt122@gmx.net<br><b>Sent:</b> Friday, June 24, 2022 5:01 AM<br><b>To:</b> postgis-users@lists.osgeo.org<br><b>Subject:</b> Re: [postgis-users] Postgis 3.0: How to convert liblwgeom to librttopo?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>Hi Regina, thank you very much for your valuable and fast reply. What I want to<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>achive is quite similar to st_snaptogrid(). I'll surely give it a try to replace our function<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>(developed in 2013) with one or more of these functions you mentioned at some<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>point in the future. But, for now, I'd like to try to go forward with liblwgeom in the<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>first place and I am glad for your hint that it is still a usable part of PostGIS 3.x.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>So, two questions arise:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>(How) can I build PostGIS via gcc and special flags from source to get the required<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>liblwgeom.h and liblwgeom.so files?<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>Or is liblwgeom already contained in the "normal" installable package, with some<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>way to access it?<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>  <o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>Thank you, Sven<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>  <o:p></o:p></span></p><div><div><div style='border:none;border-left:solid #C3D9E5 1.5pt;padding:0in 0in 0in 8.0pt;margin-left:7.5pt;margin-top:7.5pt;margin-right:3.75pt;margin-bottom:3.75pt;word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space' name=quote><div style='margin-bottom:7.5pt'><p class=MsoNormal><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>Gesendet:</span></b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'> Freitag, 24. Juni 2022 um 02:47 Uhr<br><b>Von:</b> "Regina Obe" <<a href="mailto:lr@pcorp.us">lr@pcorp.us</a>><br><b>An:</b> "'PostGIS Users Discussion'" <<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>><br><b>Betreff:</b> Re: [postgis-users] Postgis 3.0: How to convert liblwgeom to librttopo?<o:p></o:p></span></p></div><div name=quoted-content><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'>liblwgeom is still part of PostGIS but not exposed anymore as a standalone<br>library and is always statically linked. The reason is it caused too much<br>headache since we often change it even in micro versions so didn't want<br>anyone directly relying on it or our own code hooking onto the wrong version<br>installed in system.<br><br>Yes librttopo is a fork and is maintained separate from PostGIS here -<br><a href="https://git.osgeo.org/gitea/rttopo/librttopo" target="_blank">https://git.osgeo.org/gitea/rttopo/librttopo</a> .<br><br>I'm not sure if it has a hard requirement on GEOS. It definitely has pieces<br>that use GEOS, so at very least a soft requirement. It is a subset of<br>liblwgeom, that subset that was useful for topology work in particular, but<br>it probably includes the subset you need.<br><br>It's unclear to me what your function does, but some possibly useful<br>functions to achieve the same goal are:<br><br><a href="https://postgis.net/docs/ST_Subdivide.html" target="_blank">https://postgis.net/docs/ST_Subdivide.html</a><br><br><a href="https://postgis.net/docs/ST_ClipByBox2D.html" target="_blank">https://postgis.net/docs/ST_ClipByBox2D.html</a><br><br><a href="https://postgis.net/docs/ST_SquareGrid.html" target="_blank">https://postgis.net/docs/ST_SquareGrid.html</a><br><br><a href="https://postgis.net/docs/ST_HexagonGrid.html" target="_blank">https://postgis.net/docs/ST_HexagonGrid.html</a><br><br><br>Also if you are running GEOS 3.9 (+ PostGIS 3.1+) or higher, using<br><a href="https://postgis.net/docs/ST_ReducePrecision.html" target="_blank">https://postgis.net/docs/ST_ReducePrecision.html</a> (and/or the newer ST_Union,<br>ST_Intersection, ST_Subdivide) which has reduce precision logic in them<br>might solve some of your problems)<br><br>Hope that helps,<br>Regina<br><br>> -----Original Message-----<br>> From: postgis-users [<a href="mailto:postgis-users-bounces@lists.osgeo.org">mailto:postgis-users-bounces@lists.osgeo.org</a>] On<br>Behalf<br>> Of <a href="mailto:pt122@gmx.net">pt122@gmx.net</a><br>> Sent: Thursday, June 23, 2022 4:52 PM<br>> To: <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>> Subject: [postgis-users] Postgis 3.0: How to convert liblwgeom to<br>librttopo?<br>><br>> Dear Postgis community, I'm not sure if I'm in the right forum but I want<br>to<br>> give it a try. We want to upgrade from PostGIS 2.x to PostGIS 3.x and take<br>> over a self-written library (.so). This library was compiled with<br>liblwgeom of<br>> PostGIS 2.x. liblwgeom seems to be not part of PostGIS 3.x anymore<br>> (/include/liblwgeom.h is missing for instance).<br>><br>> According to the comment in <a href="https://postgis.net/2019/10/20/postgis-3.0.0/" target="_blank">https://postgis.net/2019/10/20/postgis-3.0.0/</a>,<br>> liblwgeom should be replaced with librttopo (which seems to be a fork of<br>> liblwgeom according to <a href="https://github.com/r-spatial/lwgeom/issues/30" target="_blank">https://github.com/r-spatial/lwgeom/issues/30</a>).<br>><br>> Our function that makes use of our lib, used for fast scaling, clipping<br>and<br>> sorting-out coordinates, looks like:<br>><br>> CREATE OR REPLACE FUNCTION preprocess(geometry, box2d, ...) RETURNS<br>> geometry AS 'path/to/lib.so', 'preprocess'<br>> LANGUAGE c;<br>> and in the c code are some LWGEOM*, LWMLINE*, LWMPOLY* and lwfree(..)<br>> calls.<br>><br>> My questions are:<br>><br>> - is lwgeom still part of Postgis 3.x? (I still see liblwgeom.h.in as part<br>of<br>> postgis-3.2.1.tar.gz, so it seems that is not fully removed yet)<br>><br>> - if not, what would be a good starting point for conversion?<br>><br>> - are there any mappings of old and new functions or types available?<br>><br>> -are there any packages (besides librttopo and librttopo-devel) that must<br>be<br>> installed additionally with librttopo (like GEOS or similar)?<br>><br>> -what are the PostGIS built-in alternatives for scaling and clipping?<br>><br>> Thank you for any hints, Peter<br>><br>> (See original post on<br>> <a href="https://gis.stackexchange.com/questions/434369/postgis-3-0-how-to-convert-" target="_blank">https://gis.stackexchange.com/questions/434369/postgis-3-0-how-to-convert-</a><br>> liblwgeom-to-librttopo, but my problem is likely is too specific to ask in<br>> stackexchange...) _______________________________________________<br>> postgis-users mailing list<br>> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br><br>_______________________________________________<br>postgis-users mailing list<br><a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br><a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><o:p></o:p></span></p></div></div></div></div></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana",sans-serif'> <o:p></o:p></span></p></div></div></div></div></div></body></html>