[geos-devel] Precision Howto

Martin Davis mbdavis at VividSolutions.com
Tue Sep 20 16:39:04 EDT 2005


It's hard to use equals for this.  Equals is a little too precise for
what you want.  It would be tempting to precision reduce both geometries
and then try equals, but in general precision reduction causes topology
collapse, which means that equals can't be used (the input would be
invalid).  Also, you would still have the problem of lines with extra
vertices not matching exactly.

JCS contains a feature to do just this, called DiffGeometry matcher.  It
buffers each geometry in a potential match pair by the distance
tolerance, and tests whether each one lies in the other's buffer.  This
gives a result which is probably similar to what you want.  You should
be able to do something similar in GEOS.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.      www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046


> -----Original Message-----
> From: geos-devel-bounces at geos.refractions.net 
> [mailto:geos-devel-bounces at geos.refractions.net] On Behalf Of 
> Howard Butler
> Sent: September 20, 2005 1:22 PM
> To: geos-devel at geos.refractions.net
> Subject: [geos-devel] Precision Howto
> 
> 
> All,
> 
> I have two "layers" of geometry, set A and set B.  Set A 
> could be described 
> as the base layer, and is what I would like to compare set B 
> to.  Set B is 
> actually a bastard child of set A, with some geometries being 
> (exactly) the 
> same as those in set A, some being edited manually (actual 
> changes), and 
> some being different due to inconsistent precisions (set B 
> was broken into 
> many different pieces, edited by many people with many 
> different softwares 
> and then recombined back into a single layer).
> 
> My question is, how can I use the equals() test and 
> PrecisionModels to weed 
> out the truly equal and the "equal except different by some 
> tolerance" from 
> the "truly different and edited by human hands"?  Is it 
> possible to say 
> with GEOS, "these two geometries are equal if all of their 
> vertices are 
> within 2.0 meters"?  If so, how?
> 
> Howard
> 
> PS, I'm using the Python SWIG bindings, which emit pretty 
> much the whole 
> C++ API, but could be convinced to move to C++ if it is deemed 
> C++ necessary.
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net 
> http://geos.refractions.net/mailman/listinfo/geos-devel
> 



More information about the geos-devel mailing list