1

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.

enter image description here enter image description here

3

Add 4 float columns to your table titled something like X1, Y1, X2, Y2. Then using Table > Update Column enter the following:

  • Update table: YourTable
  • Column to update: X1
  • Get value from table: YourTable
  • Value: ObjectGeography(obj, 1)

Click OK. This will update the X1 column with the minimum X value.

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

  • Beat me by 3 minutes. Page 493 of this document. – Fezter Jun 16 '16 at 7:05
  • @T_Bacon Thank you so much for your help! This worked in seconds! – Divya Jun 16 '16 at 7:25
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.