[postgis-users] How to get an interpolated point on a linestring and make sure ST_Intersects returns True?
Sandro Santilli
strk at keybit.net
Wed Oct 7 01:20:46 PDT 2015
On Wed, Oct 07, 2015 at 09:18:21AM +0200, Alessandro Pasotti wrote:
> I'm trying to get a point on a linestring such as ST_Intersects with
> the original linestring will return True but it is failing in some
> real life situations (postgres 9.3, postgis version: 2.1 USE_GEOS=1
> USE_PROJ=1 USE_STATS=1)
>
> Is this due to rounding errors?
It's due to the constrained nature of floating point numbers.
There's an infinite set of points laying in a line, but just a finite
set of them are representable.
The only way to be guaranteed a point is on a line is to pick a vertex
of that line. Snapping the input line to the closest point is what PostGIS
topology does, for example.
--strk;
() Free GIS & Flash consultant/developer
/\ http://strk.keybit.net/services.html
More information about the postgis-users
mailing list