[geos-devel] SnapPointToLine : GEOS : where is the code for st_intersects between line and point?

Sandro Santilli strk at keybit.net
Fri Nov 8 01:37:59 PST 2013


On Fri, Nov 08, 2013 at 09:58:37AM +0100, Rémi Cura wrote:

> With current PostGIS, we can design an example with 2 lines being parallel,
> but sharing an infinite number of points (http://hpics.li/58f194d , where
> square with 2 colors are shared)!

The grid in your drawing is a "fixed" precision grid.
The floating point precision grid is different, with precision reducing
(cells augmenting) as you move away from the origin.

> I'm not asking to rewrite PostGIS to permit an user specified tolerance, as
> it would be very difficult and  not even clear on theoretical ground (whole
> model of DE-9IM would be false, as in Paul example).
> I just would like not to have false geometric result because the *numeric*
> computation is wrong due to intrinsic double limitation. This is a computer
> problem, not a PostGIS problem!

By "false geometric results" you don't mean predicates here, right ?
I mean, predicates are supposedly correct, while _constructive_ geometries
suffer from the impossibility to represent the solution.

> If predicates are guarantees to be true, each one can then add a custom
> tolerance on top of it in plpgsql if needed.

This is like ST_DWithin proceeding, right ?

> Yet the question "is on line" is not robust (as proven by current
> ST_Intersects behavior).

Are you saying you have a point and a line and you can matematically
prove that the point is on the line while GEOS says otherwise ?

Or are you saying that math isn't appropriate for your more
ground-anchored need ?

> Maybe we could rewrite the question "is on line" using "left or right?",
> taking  advantage of the known inherent double precision limit?
> for example : http://hpics.li/ccf7b74
> (we construct 2 points at double_precision/2 distance on perpendicular
> line. If the 2 points have different side OR at least one is on line, we
> say the point is on the line).
> I'm not sure about this though because I don't know how the perpendicular
> construction will react in bad cases, I'll test this this in few hours.

Welcome. May I suggest you write testcases as you move forward ?

> I'm trying things with geos, but i don't know basic thinks, like how to see
> result of a printf in geos while executing sql query.

See code wrapped in DEBUG macros.
It usually prints to stderr and you find the output in postgresql logs.

--strk;


More information about the geos-devel mailing list