Hi,

I'm using Shapely to compare linestrings (e.g., contains) from
different sources. Unfortunately, as they are from different sources,
my comparisons are not as they expected due to precision loss.

Is it possible to modify the GEOS precision model[1] in Shapely? I've
tested my work in JTS TestBuilder using a fixed scale of 100000.0,
which works perfectly.

I'll provide an example for context. To see if A contains B, using
default double precision model:
A : LINESTRING (2804546.853088379 6342201.814086914, 2804586.597930257
6342227.426515108, 2804626.342772136 6342253.038943302,
2804666.0876140143 6342278.651371496, 2804705.8324558926
6342304.26379969, 2804745.577297771 6342329.876227884,
2804765.623917896 6342368.096008201, 2804789.0318718576
6342403.585924613, 2804826.622362667 6342430.003267048,
2804841.9301757812 6342474.739379883)
B : LINESTRING (2804586.597930198 6342227.426515403,
2804546.8530881978 6342201.814087403)

LINESTRING (2804546.85309 6342201.81409, 2804586.59793 6342227.42652,
2804626.34277 6342253.03894, 2804666.08761 6342278.65137,
2804705.83246 6342304.2638, 2804745.5773 6342329.87623, 2804765.62392
6342368.09601, 2804789.03187 6342403.58592, 2804826.62236
6342430.00327, 2804841.93018 6342474.73938)

A contains B = False

Changing precision model to 100000.0:

A : LINESTRING (2804546.85309 6342201.81409, 2804586.59793
6342227.42652, 2804626.34277 6342253.03894, 2804666.08761
6342278.65137, 2804705.83246 6342304.2638, 2804745.5773 6342329.87623,
2804765.62392 6342368.09601, 2804789.03187 6342403.58592,
2804826.62236 6342430.00327, 2804841.93018 6342474.73938)

B : LINESTRING (2804586.59793 6342227.42652, 2804546.85309 6342201.81409)

A contains B = True

Thanks!
-Mike

[1] 
http://geos.refractions.net/ro/doxygen_docs/html/classgeos_1_1geom_1_1PrecisionModel.html
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to