<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi Regina, thank you very much for your valuable and fast reply. What I want to</div>
<div>achive is quite similar to st_snaptogrid(). I'll surely give it a try to replace our function</div>
<div>(developed in 2013) with one or more of these functions you mentioned at some</div>
<div>point in the future. But, for now, I'd like to try to go forward with liblwgeom in the</div>
<div>first place and I am glad for your hint that it is still a usable part of PostGIS 3.x.</div>
<div> </div>
<div>So, two questions arise:</div>
<div> </div>
<div>(How) can I build PostGIS via gcc and special flags from source to get the required</div>
<div>liblwgeom.h and liblwgeom.so files?</div>
<div> </div>
<div>Or is liblwgeom already contained in the "normal" installable package, with some</div>
<div>way to access it?</div>
<div>
<div>Thank you, Sven</div>
<div>
<div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag, 24. Juni 2022 um 02:47 Uhr<br/>
<b>Von:</b> "Regina Obe" <lr@pcorp.us><br/>
<b>An:</b> "'PostGIS Users Discussion'" <postgis-users@lists.osgeo.org><br/>
<b>Betreff:</b> Re: [postgis-users] Postgis 3.0: How to convert liblwgeom to librttopo?</div>
<div name="quoted-content">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 [mailto:postgis-users-bounces@lists.osgeo.org] On<br/>
Behalf<br/>
> Of pt122@gmx.net<br/>
> Sent: Thursday, June 23, 2022 4:52 PM<br/>
> To: postgis-users@lists.osgeo.org<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/>
> postgis-users@lists.osgeo.org<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/>
postgis-users@lists.osgeo.org<br/>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></div>
</div>
</div>
</div>
</div>
<div> </div>
<div class="signature"> </div>
</div></div></body></html>