<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Adam,<br>
<br>
why do you calculate a buffer for the first linestring? If you only
want to know if there is any overlapping part of the two
linestrings, I would expect that
ST_Intersects(r1.geo_data,s1.geo_data) would do the job best. You
could combine it with
ST_Geometrytype(ST_Intersection(r1.geo_data,s1.geo_data))='ST_LineString'
in order to to find out if they only cross or really overlap.<br>
<br>
Hope that helps,<br>
<br>
Birgit.<br>
<br>
<br>
Am 03.02.2012 21:07, schrieb Adam McManus:
<blockquote
cite="mid:CALSbnorR9uH=tp+e3tQzdzR1E8Fo-23uOK8UKxsotmHHBLnqWA@mail.gmail.com"
type="cite">I'm looking for the fastest way to detect whether a
given linestring overlaps another linestring. Here's my current
approach.
<div><br>
</div>
<div>Given two tables: r1 and s1, both containing a geo_data
column of linestring, first narrow the data (taking advantage of
gist index) with r1.geo_data && s1.geo_data, then use
ST_Contains to see if s1 is overlapping r1, i.e. r1.geo_data
&& s1.geo_data
and ST_Contains(ST_Buffer(r1.geo_data,ST_Length(r1.geo_data)*.002),s1.geo_data)</div>
<div><br>
</div>
<div>This approach works, but it's extremely CPU-intensive and
slow. Is there a better approach?</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>--</div>
<div>Adam McManus</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
</pre>
</blockquote>
</body>
</html>