[postgis-users] st_equals on line with tolerance
Hugues François
hugues.francois at irstea.fr
Thu Dec 5 08:08:41 PST 2019
Hi,
Maybe you could have a look at the snaptogrid function to address this kind of precision issue.
select st_equals(st_snaptogrid(a.geom,51),st_snaptogrid(b.geom,51))
from
(select st_geomfromtext('LINESTRING(571927 6327619.2,571906.899999999 6327612.4,571826.700000003 6327586.3,571770.600000001 6327567,571718.700000003 6327549.9,571670.899999999 6327532.4,571589.5 6327505)') geom) a,
(select st_geomfromtext('LINESTRING(571927 6327619.2,571906.899999999 6327612.4,571826.700000003 6327586.3,571824.343590402 6327585.48932789,571770.600000001 6327567,571718.700000003 6327549.9,571670.899999999 6327532.4,571589.5 6327505)') geom) b
Cheers,
Hug
De: "GUILLAUME ARNAUD" <guillaume.arnaud at ledepartement82.fr>
À: "PostGIS Users Discussion" <postgis-users at lists.osgeo.org>
Envoyé: Jeudi 5 Décembre 2019 14:56:46
Objet: [postgis-users] st_equals on line with tolerance
Hi,
I need to compare these 2 lines (srid : 2154) :
"LINESTRING(571927 6327619.2,571906.899999999 6327612.4,571826.700000003 6327586.3,571770.600000001 6327567,571718.700000003 6327549.9,571670.899999999 6327532.4,571589.5 6327505)"
"LINESTRING(571927 6327619.2,571906.899999999 6327612.4,571826.700000003 6327586.3,571824.343590402 6327585.48932789,571770.600000001 6327567,571718.700000003 6327549.9,571670.899999999 6327532.4,571589.5 6327505)"
I want the result of sql say that it match ?
The difference is only this point : 571824.343590402 6327585.48932789 (add by an app) and this point is very close from the first line : 1.98930589140335e-09 m so, can i add a tolerance to compare ?
Thanks.
--
[ http://www.ledepartement.fr/ |
] Guillaume ARNAUD
Technicien SIG
Cellule SIGD
Direction des systèmes informatiques et de télécommunication
Pôle coordination et ressources
Tél : 05 63 91 82 37
[ mailto:%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20guillaume.arnaud at ledepartement82.fr |
guillaume.arnaud at ledepartement82.fr
]
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20191205/63951b7b/attachment.html>
More information about the postgis-users
mailing list