For two byte-identical geometries with at least DUPLICATE_REMOVAL_MIN_SIZE = 500 points, the --de9im output contains every relation twice. With fewer points, or with the classic relations (equals etc.), the same input is reported once. For polygons the two reports are identical. For linestrings they can disagree: the same directed pair is reported once with matrix M and once with M transposed (e.g. 10FF0FFF2 and 1FF00FFF2), and for byte-identical geometries the true matrix must be transpose-symmetric, so at least one of the two is wrong.
Here is a minimal example, two identical 1000-vertex ellipses (generator below):
$ ./spatialjoin --de9im < ellipse.txt
a 2FFF1FFF2 b
a 2FFF1FFF2 b
b 2FFF1FFF2 a
b 2FFF1FFF2 a
With 400 instead of 1000 vertices, each line appears once. The probable cause and a suggested (verified) fix are in the first comment below.
NOTE: I found this via the DE-9IM spatial join in QLever (ad-freiburg/qlever#3183). Joining the 162 Luxembourg OSM admin boundaries with themselves returns 180 instead of 162 pairs. The 18 extra rows are exactly the boundaries with ≥ 500 points.
python3 -c "
import math
n = 1000 # with 400, the output is correct
pts = ','.join(f'{5+3*math.cos(2*math.pi*i/n):.7f} {50+2*math.sin(2*math.pi*i/n):.7f}' for i in range(n+1))
print(f'a\tPOLYGON(({pts}))\nb\tPOLYGON(({pts}))')" > ellipse.txt
For two byte-identical geometries with at least
DUPLICATE_REMOVAL_MIN_SIZE = 500points, the--de9imoutput contains every relation twice. With fewer points, or with the classic relations (equalsetc.), the same input is reported once. For polygons the two reports are identical. For linestrings they can disagree: the same directed pair is reported once with matrixMand once withMtransposed (e.g.10FF0FFF2and1FF00FFF2), and for byte-identical geometries the true matrix must be transpose-symmetric, so at least one of the two is wrong.Here is a minimal example, two identical 1000-vertex ellipses (generator below):
With 400 instead of 1000 vertices, each line appears once. The probable cause and a suggested (verified) fix are in the first comment below.
NOTE: I found this via the DE-9IM spatial join in QLever (ad-freiburg/qlever#3183). Joining the 162 Luxembourg OSM admin boundaries with themselves returns 180 instead of 162 pairs. The 18 extra rows are exactly the boundaries with ≥ 500 points.