In comparing 2 regions, one must consider two kinds of data related to shape and to position. Two regions may have identical shapes and not be coincidental in space. The shape elements are many: number of parts, number of nodes, area, perimeter. Positional elements are few in nature, essentially x,y coordinates of corresponding nodes.
Notice I do not include the centroid because it is not a reliable element having a unique "value" for a region; it is not computed but assigned and can be changed within limits. Even if one would "reset" all centroids before hand (converttopline + converttoregion), there is no guarantee that the assigned centroid would be different if there are some slight differences in an outlying polygon (a polygon not containing the centroid), because it could be constrained by the limits of the "central" polygon. It would be much easier if there could be only one criterion that would do the trick. When I explored that question two years ago, I tried to use a simple all encompassing formula to compare two regions oa and ob and I found that area(erase(oa,ob),"sq mi")=0 could be a good solution. However the comparison to 0 was not efficient because the mathematics of the operator had a tendency then to "leave some accidental crumbs". I am now thinking that the solution could be area(erase(oa,ob),"sq mi") = area(erase(ob,oa),"sq mi") but isn't that just hoping that the "crumbs" will be different? Jacques Paris -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Colin Henderson Sent: March 12, 2002 06:19 To: Douglas Cubin Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: MI-L Eliminating duplicate Polygons Well, how about if you do a check on area, centroid, and number of nodes? If a polygon is a duplicate then the area, centroid, and number of nodes would be the same! In this case you could set up three variables and then look for identical polygons, the attribute OBJ_INFO_NPNTS of the ObjectInfo() function will give you the number of nodes. Area() will give you the area, and CentroidX(), CentroidY() or Centroid() functions will give you the central co-ordinates. NB: Another thing to find out is whether your polygons are single or multi-part! -----Original Message----- From: Douglas Cubin [mailto:[EMAIL PROTECTED]] Sent: 12 March 2002 11:08 To: Colin Henderson; 'paradigm' Cc: '[EMAIL PROTECTED]' Subject: RE: MI-L Eliminating duplicate Polygons This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. Not sure about that! If you know your data and know for a fact that you do not have overlapping polygons then you would be ok - Colin's recommendation in that scenario could then be sound. However, with polygons all over the place you should check on Area aswell as centroid to give improved reliability. An SQL Group By clause with Area(), Centroidx(obj) and Centroidy(obj) could do the trick. Still doesnt completely sort it though. At the end of the day a duplicate polygon has the exact same nodes. This means that all nodes in Polygon A have to be compared against all nodes in Polygon B. At least by finding the polygons with the same area and/or centroid you could start there - greatly minimizing processing time. Although node comparison isnt too difficult to do I would be interested to hear if any has worked on real-geo-de-duping(!) - perhaps there are other ways that the more mathematically minded amongst us can divulge?! Regards Doug www.gis-solved.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Colin Henderson Sent: 12 March 2002 10:12 To: paradigm Cc: [EMAIL PROTECTED] Subject: RE: MI-L Eliminating duplicate Polygons You could do a loop through the layer and get each object, query the object to find out its centroid co-ordinates and then query to see if any others have the same. Then you can just delete the identical polygons. The mapbasic user's guide or help files are as good a place as any to start learning mapbasic. ------------------------------- Kind Regards, Colin Henderson GI Developer Ordnance Survey Tel: +44 (0)2380 79 2327 mailto:[EMAIL PROTECTED] ------------------------------- -----Original Message----- From: paradigm [mailto:[EMAIL PROTECTED]] Sent: 11 March 2002 08:10 To: [EMAIL PROTECTED] Subject: MI-L Eliminating duplicate Polygons Hello, Iam new to mapbasic programming. I have hands-on experience on visual basic and SQL. Can anyone suggest me books to start with. First task given to me is to write a program to eliminate duplicate polygons in the same layer. I tried with correlated subquery in the mapbasic window. Unfortunately correlated subqueries are not supported by mapbasic. Please let me know if anyone has source code or knows method to eliminate duplicate polygons in the same layer. Anand. _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body. ******************************************************************** This Email and any attachments has been virus checked upon receipt at the OS and is free of all known viruses. ******************************************************************** *************************************************************** For more information on Ordnance Survey products and services, visit our web site at http://www.ordnancesurvey.co.uk *************************************************************** _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body. _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body. *************************************************************** For more information on Ordnance Survey products and services, visit our web site at http://www.ordnancesurvey.co.uk *************************************************************** _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body. _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body.