Subscribe to this thread
Home - General / All posts - pipe hanging
sour

126 post(s)
#03-Jul-18 04:20

Is there a way in manifold to identify segmented lines with no connection or rather hanging? This technique will help identify pipes that are not connected on other pipe network meaning –hanging; these will help me validate in advance if these pipes are for decommissioning.

sour

126 post(s)
#04-Jul-18 03:34

Ive attached the sample data fyr.

observation layer is some the sample of my concern.

Thanks!

Attachments:
Sample pipes.map

artlembo


3,400 post(s)
#05-Jul-18 15:39

two steps:

1. In the transform tool, create Node Points, and put them in a Drawing called D.

2. Run this query:

SELECT * FROM

(SELECT node, count(*) AS cnt

FROM

 (SELECT A.ID AS node

  FROM D AS A, D AS B

  WHERE touches(A.[geom (i)], B.[Geom (I)])

 )

GROUP BY node

)

WHERE cnt = 1

this will get you what you need. Of course, some "dangles" will be expected (false positives).

sour

126 post(s)
#06-Jul-18 03:11

thanks artlembo will try this query. I have overlooked your reply.

excited to test the query.

Thank you!

artlembo


3,400 post(s)
#06-Jul-18 04:14

If you don't want to use the Transform tool, and instead do everything with SQL, you can issue two queries:

First you need to get the endpoints of the lines:

SELECT * INTO D FROM

(SELECT [PRIMARY_LINES].ID, StartPoint([Geom (I)]AS g

FROM [PRIMARY_LINES]

UNION ALL

SELECT [PRIMARY_LINES].ID, EndPoint([Geom (I)]AS g

FROM [PRIMARY_LINES]

)

Now you can select the points that are dangles:

SELECT * FROM

(SELECT g, count(*) AS cnt

FROM

 (SELECT A.g

  FROM D AS A, D AS B

  WHERE touches(A.g, B.g)

 )

GROUP BY g

)

WHERE cnt = 1

artlembo


3,400 post(s)
#06-Jul-18 04:16

better yet, you can just do it with one query, and link a drawing to the query:

SELECT * FROM

(SELECT g, count(*) AS cnt

FROM

 (SELECT g FROM

    (SELECT [PRIMARY_LINES].ID, StartPoint([Geom (I)]AS g

     FROM [PRIMARY_LINES]

    UNION ALL

     SELECT [PRIMARY_LINES].ID, EndPoint([Geom (I)]AS g

     FROM [PRIMARY_LINES]

     )

 )

GROUP BY g

)

WHERE cnt = 1

artlembo


3,400 post(s)
#06-Jul-18 20:39

Here is the solution in 9 - it takes 2 queries. The first one creates the endpoints (having a STARTPOINT and ENDPOINT function would be really nice), and the second finds the dangles - apologies for the formating, it looks good when I enter it, but not so good when displayed:

SELECT ID, GeomMakePoint(xypair)

INTO endpoints

FROM 

(

SELECT ID, first(XY) AS xypair

FROM (SELECT ID, SPLIT CALL GeomToCoords([Geom (I)])

   FROM [PRIMARY_LINES]

  )

GROUP BY ID

UNION ALL

SELECT ID, first(XY) AS xypair

FROM (

SELECT ID, coord, XY

FROM (SELECT ID, SPLIT CALL GeomToCoords([Geom (I)])

   FROM [PRIMARY_LINES])

ORDER BY ID, coord DESC)

GROUP BY ID

);

SELECT * 

INTO dangles

FROM

(SELECT g, count(*) AS cnt

 FROM

 (SELECT result AS g 

  FROM

  endpoints) AS A

GROUP BY g

AS B

WHERE cnt = 1

tjhb
10,094 post(s)
#07-Jul-18 01:27

Art,

Using FIRST (with or without ORDER) to get a specific coord is not robust in 9, where FIRST and LAST should be treated as "ANY". It might always work, with small data and a single thread, but there is no guarantee.

Anyway there is no need, since we have GeomCoordXY() and GeomCoordCount(). And it can be done in a single query.

That is, if every unconnected endpoint should count as a dangling end. I don't think so--it should at least depend on distance, possibly also on closely matched direction. But that has not been specified by the OP.

artlembo


3,400 post(s)
#07-Jul-18 02:49

I will have to look at some of those functions you mentioned and see if I can trim the query down.

I agree with you about the “fuzzy tolerance“. That should be easy enough to do by simply wrapping the query in a set of parentheses and select those that are not within a certain distance.

artlembo


3,400 post(s)
#07-Jul-18 03:07

Great call, Tim. That worked like a charm, and the entire thing is done in a single query:

SELECT * INTO dangles

FROM

 (SELECT g, count(*) AS cnt 

 FROM 

 (SELECT  GeomMakePoint(GeomCoordXY([Geom (I)], 0)) AS g

   FROM [PRIMARY_LINES]

   UNION ALL

 SELECT  GeomMakePoint(GeomCoordXY([Geom (I)], GeomCoordCount([Geom (I)])-1)) AS g

 FROM [PRIMARY_LINES]AS T

 GROUP BY g) AS T2

WHERE cnt = 1

artlembo


3,400 post(s)
#07-Jul-18 03:25

I added the condition that the dangle should have another line within 2m from it to be considered a node. If it is more than 2m, then we assume that it must be a terminating node, and not a dangle. Unfortunately, to do it, I had to institute the FIRST clause again for the ID. It is a bit slower, but we've just added some nice flexibility:

SELECT g 

INTO dangles

FROM [PRIMARY_LINES],

 (

SELECT  FID, g 

FROM 

 (SELECT first(ID) AS FID, g, count(*) AS cnt 

 FROM 

 (SELECT  ID, GeomMakePoint(GeomCoordXY([Geom (I)], 0)) AS g

   FROM [PRIMARY_LINES]

   UNION ALL

 SELECT  ID, GeomMakePoint(GeomCoordXY([Geom (I)], GeomCoordCount([Geom (I)])-1)) AS g

 FROM [PRIMARY_LINES]AS T

 GROUP BY g) AS T2

WHERE cnt = 1) AS T3

WHERE GeomDistance(g, [Geom (I)], 0) < 2

AND FID <> ID

sour

126 post(s)
#07-Jul-18 09:02

Holy smoke! just been away for about a day ... too much input going on here!

I have test the first methodology and its what i wanted ..... then I gotta try this incoming stuff .... Im getting overloaded ! and with a big thanks!

artlembo


3,400 post(s)
#07-Jul-18 22:38

Here is an update with the FIRST clause removed. It doesn't really do much in terms of speed, but perhaps it is more straightforward:

SELECT g 

INTO dangles

FROM [PRIMARY_LINES],

 (

SELECT   g 

FROM 

 (SELECT g, count(*) AS cnt 

 FROM 

 (SELECT  GeomMakePoint(GeomCoordXY([Geom (I)], 0)) AS g

   FROM [PRIMARY_LINES]

   UNION ALL

 SELECT  GeomMakePoint(GeomCoordXY([Geom (I)], GeomCoordCount([Geom (I)])-1)) AS g

 FROM [PRIMARY_LINES]AS T

 GROUP BY g) AS T2

WHERE cnt = 1) AS T3

WHERE GeomDistance(g, [Geom (I)], 0) BETWEEN 0.01 AND 2

artlembo


3,400 post(s)
#07-Jul-18 22:49

this can also be done in PostGIS as well:

SELECT g 

INTO dangles

FROM plines,

 (

SELECT   g 

FROM 

 (SELECT g, count(*) AS cnt 

 FROM 

 (SELECT  ST_StartPoint("Geom (I)"AS g

   FROM plines

   UNION ALL

 SELECT  ST_EndPoint("Geom (I)"AS g

 FROM plines ) AS T

 GROUP BY g) AS T2

WHERE cnt = 1) AS T3

WHERE ST_Distance(g, "Geom (I)"BETWEEN 0.01 AND 2

Forest
625 post(s)
#04-Jul-18 07:09

I am not a pipeline guru but for a quick and dirty method, I downloaded your data, buffered the pipeline by one unit (specifying units is good practice). This created a very small buffer around each pipe. I then used the transform bar in M8 to union all the buffers which merges all the touching buffers. The hanging buffers are also added to the unioned buffer record and to get these back out, I ran the dissolve transform. That makes a separate record for each connected portion of your network. If you put the buffer over your primary lines drawing then click on a section of the buffer the connected network with be highlighted and gaps wider than 2 units with result what look like connected pipes that are not connected become visible (not highlighted).

You could sort the buffers by area to find the little bits and pieces that are not connected.

This is a crude way of doing things but then again, if your pipelines are not properly snapped together at the ends in the GIS, then this crude method might work better than a proper method.

I used M8 but M9 should be just as good.

Forest
625 post(s)
#04-Jul-18 23:41

Hi Sour,

The answer to your question also depends on network topology. Water is a distribution network, Sewage is collection network and gas is different again so it would be nice to know a bit more about what you are working with.

sour

126 post(s)
#05-Jul-18 03:32

thanks forest, yes will try your methodology.

I think think is there a way to determine pipes or lines that are not "snapped".

This would do also.

dchall8
1,008 post(s)
#05-Jul-18 15:07

If you open the table for your pipe drawing and View>Columns... you will get a dialog box. In that dialog scroll down to the Coordinates (I) field and check the box. Click OK and the table will show how many points are along the pipe objects. For a line object there will be a coordinate at each end of the pipe and one for all the connected nodes between the ends. The minimum number of coordinates for a line is 2. Sort the table by clicking on the Coordinates (I) heading. Pipes with only 2 coordinates are straight pipes which likely are not connected to any other pipes. They might have a coordinate snapped to another coordinate, but they will appear in the table as having 2 coordinates. To see if those pipes are duplicated by another pipe, you could offset them slightly with the Move Vertically, Move Horizontally, or Rotate transforms. It is possible to have pipes which have bends in them and still be disconnected at one end or the other. Those would have 3 or more coordinates. You would have to evaluate the lines manually, but at least you can identify them and zoom right to them in a Map layer/drawing.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.