Hi Charlie,

I recall a discussion some (many) months back about this. 

I tried what you suggested re altering the centroids using the region object
dialog box but this also changes the MBR and appears to impact on the shape
of the region.

My guess is that you will not be able to do what you want from the command
line( mapbasic window) and will need a little mapbasic application to
provide the functionality for you.

The simplest approach would be to create a new object based on the existing
one plus the user defined centroid location using the mapbasic create region
statement. The syntax of which is:

        Create Region 
        [  Into  { Window   window_id  |  Variable   var_name } ] 
           num_polygons 
           [  num_points1   (  x1,  y1 )   (  x2 ,  y2 )  [ ... ]  ] 
           [  num_points2   (  x1,  y1 )   (  x2 ,  y2 )  [ ... ]   ... ] 
        [ Pen . . . ]
        [ Brush . . . ]
        [ Center ( center_x,  center_y )  ] 


Therefore you code would go something like

1) get user to select region and enter centroid x,y (use dialog statement)
2) grab the region object
3) for each node get the x,y values
        eg 
        For i = 1 to objectinfo(myobj,OBJ_INFO_NPNTS) 
                x(i) = objectnodex(myobj,1,i)
                y(i) = objectnodey(myobj,1,i)
        Next 


4) use these node coordinates and the user defined centroids (plus the
symbology data from the original object) to create the new object
5) update the original selection with the new object.

If there is an easier way I would be keen to also know as the alter object
geography clause does not appear to have any centroid options.


Cheers

Martin
==================================
Martin Roundill
GIS Manager
Waitakere City Council
Private Bag 93109
Henderson
Waitakere City
New Zealand


-----Original Message-----
From: Charlie Bernhardt [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 8 February 2000 07:56
To: [EMAIL PROTECTED]
Subject: MI Changing a region object's centroid coordinates

.......
Apparently I didn't explain clearly enough what exactly
I want to do. I want to be able to do, programatically,
what I can do interactively in MapInfo. In MapInfo, with
MYFILE editable, I can double click on the region object
(only one object in the file), which brings up the region
object dialog, where I can type in new values for "Center X"
and "Center Y".
......

I want to do this as part of a MapBasic program, but have been trying to
do it first in the MapBasic window. I have been unable to use the update
command to accomplish the task. I get syntax error type messages, no
matter how I try to do it. Can anyone help with this?

Thanks in advance
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to