What is the best way to perform a diff operation on Postgis features/tables or Geotools objects? Are there any automatic methods I can use? If not, what would be the optimal way to implement your own diff? For example I have two versions of a Shapefile and I import them into two separate PostiGIS tables, what algorithm should I consider now - how to compare a geometry column and get a diff result? I would be grateful for any advices or links to additional sources/articles concerning this matter.


Not absolutely clear what you are trying to do, but you may want to take a look at ST_Equals, ST_Difference functions.


http://postgis.net/docs/manual-2.0/ST_OrderingEquals.html (if you expect things to be more or less exact)


Then you do a join something of form

SELECT t1.gid
  FROM t1 LEFT JOIN t2 ON ST_OrderingEquals(t1.geom, t2.geom)

Would give you all the gids that are not exactly represented in second table.

|improve this answer|||||

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.