I have created 250 square meter grids using the Grid Maker tool. I have given each grid a unique name. I want to find and store bounding co-ordinates (Latitude and Longitude) of each polygon in the Grid table along with the unique grid name. In short, I want to extract values that are displayed when you select "Get Info" upon Right-Click of any polygon. Please check screenshots for reference. I'm using MapInfo 15.
float columns to your table titled something like
X1, Y1, X2, Y2. Then using
Update Column enter the following:
- Update table:
- Column to update:
- Get value from table:
Click OK. This will update the X1 column with the minimum X value.
Y1 change the column to update to
Y1 and the Value to
ObjectGeography(obj, 2) for the minimum Y value.
X2 will be
ObjectGeography(obj, 3) and is the maximum X value, and finally
Y2 will be
ObjectGeography(obj, 4) for the maximum Y value.
And if you prefer a statement for your MapBasic window:
Set CoordSys Table MYTABLE Update MYTABLE Set MIN_X = ObjectGeography(OBJ, 1) , MIN_Y = ObjectGeography(OBJ, 2) , MAX_X = ObjectGeography(OBJ, 3) , MAX_Y = ObjectGeography(OBJ, 4)
The first statement asks MapInfo Pro to use the coordinate system of the table when extracting coordinates.
The second does the actual update of the four columns.