Mmm, so it is a floating point issue - the distance is 9.57711783686133e-12 meters. Is there anyway to specify a tolerance for ST_Intersects and similar predicates?<br><br>-Francis<br><br><div class="gmail_quote">On 3 May 2010 17:53, strk <span dir="ltr"><<a href="mailto:strk@keybit.net">strk@keybit.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Mon, May 03, 2010 at 04:41:09PM +1000, Francis Markham wrote:<br>
> Hi all,<br>
><br>
> I think I've got a bit of a problem with snapping points to lines. I had<br>
> thought that using line_interpolate_point(..., line_locate_point(...)) would<br>
> do the trick, but this seems not to be the case:<br>
<br>
</div>Francis,<br>
thing is that the constructive functions have to deal with representability<br>
of numbers which means you won't always get the exact point of intersection<br>
but rather the best approximation of it.<br>
Instead the predicates (like ST_Intersects) give you the exact answer.<br>
You may try the distance functions to see how much the intersection point<br>
is off the line, should be a really low number.<br>
<br>
--strk;<br>
<div class="im"><br>
> gis=# SELECT ST_AsText(v.the_geom), ST_SRID(v.the_geom),<br>
> ST_AsText(r.the_geom), ST_SRID(r.the_geom) FROM road_segments AS r, venues<br>
> AS v WHERE v.venue_id = 29 AND r.gid = 100982;<br>
><br>
> st_astext | st_srid<br>
> |<br>
> st_astext | st_srid<br>
> ------------------------------------------+---------+---------------------------------------------------------------------------------+---------<br>
> POINT(415185.606066865 7827721.52951473) | 28353 |<br>
> LINESTRING(415250.679102704 7827994.85292521,415218.694181662<br>
> 7827642.44920486) | 28353<br>
> (1 row)<br>
><br>
> gis=# SELECT ST_Intersects(ST_line_interpolate_point(r.the_geom,<br>
> ST_line_locate_point(r.the_geom, v.the_geom)), r.the_geom) FROM<br>
> road_segments AS r, venues AS v WHERE v.venue_id = 29 AND r.gid = 100982;<br>
><br>
> st_intersects<br>
> ---------------<br>
> f<br>
> (1 row)<br>
><br>
> gis=# SELECT postgis_full_version();<br>
><br>
><br>
> postgis_full_version<br>
> ----------------------------------------------------------------------------------------<br>
> POSTGIS="1.4.1" GEOS="3.2.1-CAPI-1.6.1" PROJ="Rel. 4.7.1, 23 September<br>
> 2009" USE_STATS<br>
> (1 row)<br>
><br>
><br>
><br>
> Any assistance would be much appreciated.<br>
><br>
> Thanks,<br>
><br>
> -Francis Markham<br>
<br>
</div>> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<font color="#888888"><br>
<br>
--<br>
<br>
() Free GIS & Flash consultant/developer<br>
/\ <a href="http://strk.keybit.net/services.html" target="_blank">http://strk.keybit.net/services.html</a><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</font></blockquote></div><br>