3

I have a couple of featureclasses in a 10.2 geodatabase/PostgreSQL 9.2.2 database and I've been struggling with the FeatureCompare tool--it is telling me geometries are different on some features where I know them to be at least spatially equal.

Luckily, I have an ID and I could join between the 2 tables in PGAdmin and compare geometry. The ~= opreator and the ST_Equals both return true for every row. Then I modified 1 feature by moving 1 vertex 800 ft to the South.

When I run my query, ST_Equals returns false which is what I expect. But ~= still returns true??? Why is that?

select t1.shape,t2.shape ,(t1.shape ~= t2.shape) as exactequal , ST_Equals(t1.shape , t2.shape) spatialequal, (t1.shape = t2.shape) bndequal
from  pg.Test1 t1
inner join pt.Bnd2 t2
on t1.polygon_id=t2.polygon_id
where t1.objectid = 6389

enter image description here

I trying to figure out if this is a bug or if I'm misunderstanding the operators.

"PostgreSQL 9.2.2, compiled by Visual C++ build 1600, 64-bit"
"POSTGIS="2.0.4" GEOS="3.4.2-CAPI-1.8.2 r0" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.0, released 2013/04/24"

5

As the doc says ~= only compares bounding boxes. So if you move a point in a way that it doesn't change the bounding box ~= still returns true.

  • Maybe i was looking at old docs. The one i was looking at said equal sign only was bounding box compare. – Jay Cummins Feb 1 '14 at 11:29
  • Sure enough, I was looking at 1.3 docs: The "~=" operator is the "same as" operator. It tests actual geometric equality of two features.. And 2.0 docs have it as: Returns TRUE if A's bounding box is the same as B's.. – Jay Cummins Feb 1 '14 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.