[postgis-users] line_interpolate_point does not return a point that intersects the line
Francis Markham
fmarkham at gmail.com
Mon May 3 01:15:14 PDT 2010
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?
-Francis
On 3 May 2010 17:53, strk <strk at keybit.net> wrote:
> On Mon, May 03, 2010 at 04:41:09PM +1000, Francis Markham wrote:
> > Hi all,
> >
> > I think I've got a bit of a problem with snapping points to lines. I had
> > thought that using line_interpolate_point(..., line_locate_point(...))
> would
> > do the trick, but this seems not to be the case:
>
> Francis,
> thing is that the constructive functions have to deal with representability
> of numbers which means you won't always get the exact point of intersection
> but rather the best approximation of it.
> Instead the predicates (like ST_Intersects) give you the exact answer.
> You may try the distance functions to see how much the intersection point
> is off the line, should be a really low number.
>
> --strk;
>
> > gis=# SELECT ST_AsText(v.the_geom), ST_SRID(v.the_geom),
> > ST_AsText(r.the_geom), ST_SRID(r.the_geom) FROM road_segments AS r,
> venues
> > AS v WHERE v.venue_id = 29 AND r.gid = 100982;
> >
> > st_astext | st_srid
> > |
> > st_astext | st_srid
> >
> ------------------------------------------+---------+---------------------------------------------------------------------------------+---------
> > POINT(415185.606066865 7827721.52951473) | 28353 |
> > LINESTRING(415250.679102704 7827994.85292521,415218.694181662
> > 7827642.44920486) | 28353
> > (1 row)
> >
> > gis=# SELECT ST_Intersects(ST_line_interpolate_point(r.the_geom,
> > ST_line_locate_point(r.the_geom, v.the_geom)), r.the_geom) FROM
> > road_segments AS r, venues AS v WHERE v.venue_id = 29 AND r.gid = 100982;
> >
> > st_intersects
> > ---------------
> > f
> > (1 row)
> >
> > gis=# SELECT postgis_full_version();
> >
> >
> > postgis_full_version
> >
> ----------------------------------------------------------------------------------------
> > POSTGIS="1.4.1" GEOS="3.2.1-CAPI-1.6.1" PROJ="Rel. 4.7.1, 23 September
> > 2009" USE_STATS
> > (1 row)
> >
> >
> >
> > Any assistance would be much appreciated.
> >
> > Thanks,
> >
> > -Francis Markham
>
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> --
>
> () Free GIS & Flash consultant/developer
> /\ http://strk.keybit.net/services.html
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100503/780c280e/attachment.html>
More information about the postgis-users
mailing list