<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Hi All!<div>I'm currently trying to write a query to do the following: I need to find all line segments that have an end point or a start point that doesn't overlap with everything.  Here's what I had so far:</div>
<div><br></div><div><div>SELECT t1.osm_id, ST_StartPoint(t1.way)</div><div>FROM "OSMData".osm_mn_data_highway_20101129_101234 t1,</div><div>"OSMData".osm_mn_data_highway_20101129_101234 t2</div><div>WHERE t1.way && t2.way</div>
<div>AND t1.osm_id <> t2.osm_id</div><div>AND NOT ST_Intersects(ST_StartPoint(t1.way), t2.way)</div><div>UNION</div><div>SELECT t1.osm_id, ST_EndPoint(t1.way)</div><div>FROM "OSMData".osm_mn_data_highway_20101129_101234 t1,</div>
<div>"OSMData".osm_mn_data_highway_20101129_101234 t2</div><div>WHERE t1.way && t2.way</div><div>AND t1.osm_id <> t2.osm_id</div><div>AND NOT ST_Intersects(ST_EndPoint(t1.way), t2.way)</div></div><div>
<br></div><div>way = GEOMETRY</div><div>osm_id = INTEGER (id)</div><div><br></div><div>(I'm working on some OpenStreetMap data in case you're curious)</div><div>This query doesn't give me what I want.  If there exists a t2 within t1's bounding box that doesn't intersect t1's start/end point, then it gets included into the list (false positives).  I want to select rows who's geometry's start/end point does not intersect *anything*.  I have a feeling that I should be using some sort of grouping operator, but I'm lost.</div>
<div><br></div><div>Any help would be greatly appreciated.</div><div><br></div><div>Brian Stempin</div><div><a href="http://brianstempin.com/" target="_blank" style="color: rgb(51, 51, 204); ">http://brianstempin.com</a></div>
</span>