[postgis-users] Help with Query

Clifford Snow clifford at snowandsnow.us
Sat Jan 12 18:50:28 PST 2013


On Fri, Jan 11, 2013 at 6:07 PM, Stephen Woodbridge <woodbri at swoodbridge.com
> wrote:

> So you strategy could be:
>
> 1. find all nodes that have only on edge associated with them. In this
> model that would be nodes 1, 6, and a and may be filter the edges to be
> short edges only. the following sql is close to this:
>
> select a.pt, count(*) as cnt
>   from
>        ( select st_startpoint(geom) as pt from flowlines
>          union
>          select st_endpoint(geom) as pt from flowlines
>        ) as a,
>        flowlines b
>   where st_dwithin(a.pt, b.geom, 0.000001)
>         and st_length(b.geom) <  <maxlen>
>   group by a.pnt
>   having cnt = 1;
>
> 2. if your selection criteria is a branch off the main line, rather than
> and extension of the main line, then you can eliminate the end segments
> that have only a sing edge connecting to the far end. This would eliminate
> 5-6 because 5 has too edges, but 3 has 3 edges. You have to decide what to
> do if 5 has a branch to 7 also.
>
> So we should be able to use the points above to select the edges of the
> dangling segments, then get the opposite end point, and count the edges
> connected to the opposite end. The SQL is more complex for this part and I
> need to think more about how to do that.
>


Thanks - I think your approach is getting me in the right direction. I'm
doing subsequent processing to the data and that is where the problems are
showing up. If this approach is right, and I believe it is, then my problem
might be in the post processing script.

-- 
Clifford

OpenStreetMap: Maps with a human touch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130112/ab7839e4/attachment.html>


More information about the postgis-users mailing list