I have a LineString table in PostGIS, which represents wiring in streets. Where the geometry column represents the wiring lines; firstpoint is the first geometry point (cable segment); lastpoint the last geometry point; id_startpoint and id_enpoint are identifiers of the firstpoint and lastpoint columns.

introducir la descripción de la imagen aquí

In OpenLayers v5 it is shown as follows:

Tabla Line en PostGIS

The point is that I want to detect the rings (cycles) in the structure of the network. As shown below:

introducir la descripción de la imagen aquí

My solution was to use the DFS algorithm in javascript to detect cycles in undirected graphs, which works well until I give the 5327 registers (too much data), however with 200 registers it works fine. For this reason, I want to use some PostGIS function to find the cycles. You could recommend some function to me since there is ST_NumInteriorRings and ST_ExteriorRing but they are for polygons, I need a function for LineString.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.