<div dir="ltr">I tried something similar, but the problem is streams are made of up various length linestrings. Some have only two nodes but are part of what makes up the entire stream. The ones I looking for are just short lengths with only one end near the main stream. for example if the following is a stream:<div>
<br></div><div style>1 2 3 4 5 6</div><div style>o---------o-------------o---------------o--------------o---------o</div><div style> |</div>
<div style> |</div><div style> o</div><div style> a</div><div style><br></div><div style>I'm looking to capture the extension "a" above. It's possible that I'll also capture "6" but these short linestrings are always two nodes and are less than 25' in length. However, there are thousands of short two node lines strings that are part of the stream. </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 5:03 PM, Stephen Woodbridge <span dir="ltr"><<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 1/11/2013 7:20 PM, Clifford Snow wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
First off, I'm a new at Postgis so please let me know if the right<br>
response to my question is RTFM.<br>
<br>
I have the NHD streams for my state that I want to import into<br>
OpenStreetMap. When I select just the streams that I'm interested in I<br>
find that there are numerous short linestrings (2 nodes) that I'd like<br>
to get rid of. These linestrings are only connected at one end. It<br>
seems like ST_Touches() would find them. I did a simple query of<br>
<br>
SELECT s1.gid, s2.gid from flowlines s1, flowlines s2 WHERE<br>
ST_Touches(s1.geom,ST_PointN(<u></u>s2.geom,1) and s2.pointcount = 2;<br>
<br>
It returns 0 rows. Changing the point on s2.geom to 0 makes no difference.<br>
<br>
Anyone have a suggestion of how I find 2 node streams that connect to<br>
another stream?<br>
</blockquote>
<br></div></div>
You might try creating a topology. I have not actually done this myself since I using pgRouting for a lot of stuff and it has its own topology tools for building graphs that I'm more familiar with.<br>
<br>
You also might try using st_dwithin( geom1, geom2, tolerance )<br>
where tolerance needs to be in the units of your data.<br>
<br>
select s1.gid, s2.gid<div class="im"><br>
from flowlines s1, flowlines s2<br></div>
where s2.pointcount = 2<br>
and st_dwithin(s1.geom, s2.geom, 0.000001 )<br>
and s1.gid != s2.gid;<br>
<br>
YMMV,<br>
-Steve<br>
______________________________<u></u>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-<u></u>bin/mailman/listinfo/postgis-<u></u>users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Clifford</div><div><br></div><div>OpenStreetMap: Maps with a human touch</div>
</div>