I must disagree with this approach that stems for a false premise, the
notion that in MapInfo a centroid can be outside its polygon. It is
impossible by MI definition. Try to pull a centroid away from its polygon to
find out (map | layer control | display > show centroid  and make layer
editable, + reshape via ctrl R or tool, then grab the centroid and pull it
away; it will come back in its polygon). Even in MapBasic, the center
argument is overridden by MI when the object is inserted in its map, which
means that you cannot force a centroid outside its polygon.

The original question should thus be answered simply: a region with its
centroid outside one of the region's polygons does not exist in MI.

Jacques PARIS

mailto:[EMAIL PROTECTED]

For MapInfo support, visit the Paris PC Consult enr. site  at
http://www.paris-pc-gis.com/

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Spencer Simpson
Sent: May 10, 2001 9:19 AM
To: Mapinfo Mailing List
Subject: Re: MI-L MI/MB Geocoding problem

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.



_______________________________________________________________________
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