Hi Kevin,<div>Thanks for taking a stab at my problem.</div><div><br></div><div>Response in-line:</div><div><br><div class="gmail_quote">On Mon, Nov 29, 2010 at 4:36 PM, Kevin Neufeld <span dir="ltr"><<a href="http://kneufeld.ca" target="_blank">kneufeld.ca</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000"><div>
On 11/29/2010 11:54 AM, Brian Stempin wrote:
<blockquote type="cite"><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">I
want to select rows who's geometry's start/end point does not
intersect *anything*</span></blockquote>
<br></div>
Is your dataset fully noded (where the only intersection between
geometries occur at the endpoints)?<br></div></blockquote><div><br></div><div>There are places where segments run through endpoints and segments run through other segments.</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">
If so, you could perform a very quick GROUP BY query to find
degree-1 nodes in your network.<br>
<br>
<tt>SELECT min(osm_id), pt<br>
FROM (<br>
SELECT osm_id, ST_StartPoint(way) AS pt<div><br>
FROM "OSMData".osm_mn_data_highway_20101129_101234 <br>
<br></div>
UNION ALL<br>
<br>
SELECT osm_id, ST_EndPoint(way) AS pt<div><br>
FROM "OSMData".osm_mn_data_highway_20101129_101234 <br></div>
) AS grouped<br>
GROUP BY pt<br>
HAVING count(*) = 1;</tt></div></blockquote><div><br></div><div>Yeah, I'm getting waaay too many results from this query. I take it that this is because my data is not fully noded?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">
Note though, that this GROUP BY approach uses the bounding boxes of
the endpoints, *not* the geometries themselves. So for this to
work, the precision of your dataset must be less than what can be
represented in the float4 representation of the bounding box.<br></div></blockquote><div><br></div><div>My data is precise enough to support this.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">
ie.<br>
<tt>SELECT st_astext(st_collect(column1)) <br>
FROM ( VALUES <br>
('POINT(0 0)'::geometry), <br>
('POINT(0 1)'::geometry), <br>
('POINT(0 0.0000001)'::geometry)<br>
) AS foo <br>
GROUP BY column1;<br>
st_astext <br>
-------------------------<br>
MULTIPOINT(0 0,0 1e-07)<br>
MULTIPOINT(0 1)<br>
(2 rows)</tt><br>
<br>
See how the first and last points have the same bounding box though
different geometries?.<br>
<br>
As long as your data is fully noded and the precision is less than
what can be represented as a float4, then this approach works very
fast (no expensive spatial predicate operations)<br>
<br>
Cheers,<br>
Kevin<br></div></blockquote><div><br></div><div>Thanks for the stab. I'll stew on this more when I get home. Time to catch the train!</div><div>Brian </div></div></div>