Doug Pease wrote:

> Is there some way to check (within a MB function) if a polygon centroid is
> outside its polygon?

Yes, You can make a copy of the polygon table, then replace each polygon
with a point
at the polygon's centroid.

1. Use SQL Select to select only the Unique ID column from your polygon
table
(the polygons will be automatically selected).
2.  Use "File -> Save Copy As..." to save this selection to disk.
3.  Open the table you just created (we'll call it "MyCopy").
4. Using "Table->Maintenance->Table Structure",  Add a LOGICAL column to the
original table (call it "CIP" or something like that).
5. Rename the UniqueID column of MyCopy to something that doesn't name a
column of the original table.
5.  Options -> Show MapBasic Window.
6.  In the MapBAsic window, type

Update MyCopy set obj=CreatePoint(CentroidX(obj),CentroidY(obj))

then hit ENTER.

7.  Save the changes to MyCopy.
8.  Using SQL Select, make a geographic join of the original table and
MyCopy  (selecting all columns)  where OriginalTab.obj contains MyCopy.obj.
9.  Make a selection from the results of the query used in Step 8, where the
Unique ID column equals the new name you came up with in step 5.
10.  Use Table -> Update Column on the query produced in step 9.  Update the
column you created in step 4 with 1.   This will set the "CIP" value of all
the parcels that contain their centroids to "TRUE".

It's then a matter of selecting from the original table where the CIP Column
is FALSE to
find the parcels that don't contain their centroids.

I must warn you, however, that you will probably find a *lot* of these
polygons.  Updating an object's centroid in MapBasic is a rather difficult
process that I'd rather not go into
here, but I'm sure someone has written a tool to automatically update
polygon centroids with points guaranteed to be inside the polygons.  Of
course, you can update
centroids manually with later versions of MapInfo.

HTH
Spencer




_______________________________________________________________________
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.

Reply via email to