If I understand what you're saying, you're wondering why:
(1) B.within(A) = false
and if C = A.intersection(B),
the (2) why does C.within(A) = false ?
The reason for this is that predicates are evaluated on the exact values
of the coordinates of the geometry. The left-hand edge of A is not
exactly vertical, and the left-hand coordinates of B do not lie exactly
on it. One or more of them in fact must lie *outside* A - hence B is
not within A.
The reason for (2) is a bit more subtle. Spatial overlay operations
like intersects are of necessity approximations to the true answer (due
to the finiteness of FP representation & arithmetic). JTS also contains
code which attempts to deal with robustness errors by doing some further
adjustments and approximations. For this reason, A.intersection(B)
actually returns the value of B - it's just not possible to compute a
"finer" result without errors occuring. Thus of course it also does not
lie within A.
In general, overlays cannot be assumed to be exact, and they can't be
assumed to be fully consistent with other spatial operations.
HTH - Martin
Maximilian Aulinger wrote:
Dear JTS-Developers,
hopefully you can help me with the following questions concerning
the intersection method in JTS. (I'm using JTS version 1.8.0)
I have the following two geometries:
A: MULTIPOLYGON (((4481815.080184811 5368061.362333608,
4481815.281863633 5367969.823895859, 4481729.02549907
5367970.009263248, 4481728.9548466 5368061.369499856,
4481815.080184811 5368061.362333608)))
B: POLYGON ((4481729.007480305 5367993.309208868, 4481728.995611404
5368008.656804442, 4481728.987974629 5368018.531867001,
4481739.856713683 5368018.531867001, 4481739.856713683
5367993.309208868, 4481729.007480305 5367993.309208868))
Though the difference between A and B is an empty geometry
collection, B doesn't lie within A.
I've intersected A and B to get a geometry which completely lies
within A, but the resulting polygon is identical to polygon B and does
therefore not lie within A.
Shouldn't the intersection of A and B always lie within the given
geometries or do I get the intersect method/within predicate wrong?
Is there anything wrong with my geometries or could this possibly be a
bug in JTS?
Thanks in advance and best regards,
Max
------------------------------------------------------------------------
Maximilian Aulinger
phone: +49 (89) 121528-45 mailto:[EMAIL PROTECTED]
fax: +49 (89) 121528-79 http://www.gaf.de <http://www.gaf.de/>
GAF AG Arnulfstr. 197 80634 Muenchen Germany
Vorstand: Dr. Peter Volk, Aufsichtsratsvorsitzender: Marcello Maranesi
Firmensitz: Muenchen, Amtsgericht Muenchen HRB 140 509
------------------------------------------------------------------------
_______________________________________________
jts-devel mailing list
jts-devel@lists.jump-project.org
http://lists.refractions.net/mailman/listinfo/jts-devel
--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022
_______________________________________________
jts-devel mailing list
jts-devel@lists.jump-project.org
http://lists.refractions.net/mailman/listinfo/jts-devel