[postgis-users] [Question] Point returned in ST_LineLocatePoint and ST_ClosestPoint is not able to detect in ST_Contains
dharshan4help at gmail.com
Wed Sep 30 05:29:48 PDT 2015
Thanks for the reply,
Yes, I tried with ST_DWithin and it is working fine now.
But then, according to doc "closest point on LineString to the given Point"
is wrong statement right?
And in "ST_DWithin(line,
point, 0.00001)" , 0.000001 is in meter? what is the least /last value we
*Thanks & RegardsDharshan*
On Wed, Sep 30, 2015 at 5:54 PM, Paul Ramsey <pramsey at cleverelephant.ca>
> Unfortunately, due to the vagaries of the IEEE double precision grid,
> your constructed point probably does not like *exactly* on your line,
> but ever-so-slightly off. Try testing instead for ST_DWithin(line,
> point, 0.00001) or something and it should work better.
> On Tue, Sep 29, 2015 at 9:59 PM, Dharshan Bharathur
> <dharshan4help at gmail.com> wrote:
> > Hi all, Need experts advice.
> > This is the same question I have asked here.
> > I am using postgis's ST_LineLocatePoint to find out the closest point on
> > LineString to the given Point, and using ST_LineInterpolatePoint to
> > a Point from the returned float number.(as referred here)
> > This is my ST_LineLocatePoint Query
> > SELECT ST_AsText(ST_LineInterpolatePoint(foo.the_line,
> > ST_LineLocatePoint(foo.the_line,ST_GeomFromText('POINT(12.962315
> > 77.584841)')))) AS g FROM (SELECT
> > ST_GeomFromText('LINESTRING(12.96145
> > 77.58408,12.96219 77.58447,12.96302 77.58489,12.96316
> > 77.58496,12.96348
> > 77.58511)') AS the_line) AS foo;
> > Output:
> > g
> > ------------------------------------------
> > POINT(12.9624389808159 77.5845959902924)
> > Which exactly lies on the linestring I have passed. Demonstration is
> > displayed here.
> > query with St_Closest function also returns the same points.
> > But when I check whether this point lies in the same linestring using
> > ST_Contains it always return false, even though the point lies within.
> > My ST_Contains Query:
> > SELECT ST_Contains(ST_GeomFromText('LINESTRING(12.96145 77.58408,12.96219
> > 77.58447,12.96302 77.58489, 12.96316 77.58496, 12.96348
> > 77.58511)'),ST_GeomFromText('POINT(12.9624389808159 77.5845959902924)'));
> > Output:
> > st_contains
> > -------------
> > f
> > I am not getting where I am doing wrong, why I am getting false. Can
> > help me in this.
> > I am using Postgresql : 9.4, postgis : 2.1
> > Thanks & Regards
> > Dharshan
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at lists.osgeo.org
> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> postgis-users mailing list
> postgis-users at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the postgis-users