From a.furieri at lqt.it Tue May 1 04:38:36 2018 From: a.furieri at lqt.it (a.furieri at lqt.it) Date: Tue, 01 May 2018 13:38:36 +0200 Subject: [rttopo-dev] Help in using the library In-Reply-To: References: Message-ID: <773a0c4a4c762450fae9cbbb32d569c8@lqt.it> On Mon, 30 Apr 2018 14:42:40 -0300, Roberto Ribeiro wrote: > Hello list, > > I was directed here by the nice folks at the PostGIS-devel list. > Sorry > if this is the wrong place to ask these questions. > > Basically what I wanted was to create a set of tools that read > PostGIS > geometries and worked on them, all wrapped in as a Postgres > extension. > While that seemed straighforward enough with the PostGIS API, I'm at > a > loss as to how to do that with RT-Topo. I see I have to work with > RTCTX, which I'm not entirely sure how to initialize, and > RTT_BE_IFACE, which I'm even less certain how to set up. > > Could anyone provide me with an example code that implements > librttopo > in a manner similar to what I intend, so I could have an idea of > where > to start from? I tried searching online for one, but came out empty > handed. > Hi Roberto, the RtTopo library is mainly intended to support ISO-Topology, although it can effectively support several advanced useful spatial functions not directly available when using GEOS alone (as e.g. MakeValid, Split, Segmentize, Azimuth, 3dDistance, 3dLength and so on). RtTopo is a derivative from PostGIS own LWGEOM, but is not specifically intended for PostgreSQL/PostGIS, and attempts as far as possible to support a "backend agnostic" approach. so it necessarily requires something like "an abstract interface" (RTCTX and RTT_BE_IFACE) intended to translate generic abstract methods into C and SQL commands specifically intended for the DBMS that is your current target. AFAIK there is just one Spatial DBMS currently supporting RtTopo, and it's SpatiaLite. You can learn more about how-to handle RTCXT and RTT_BE_IFACE by reading these two source files: [1] https://www.gaia-gis.it/fossil/libspatialite/artifact/48a145c3a56cef9c [2] https://www.gaia-gis.it/fossil/libspatialite/artifact/071154ce5c1aa112 but more in general, all the sources you'll find into the "topology" directory contain many useful code examples. bye Sandro p.s. if you are just interested into "create a set of tools that read PostGIS geometries and worked on them, all wrapped in as a Postgres extension" and are not specifically interested into Topology, or into advanced Spatial SQL Functions, or into supporting multiple backends (MySQL, SQLite and alike) I strongly doubt that RtTopo could be the tool you are looking for.