0

I have a table in MG94 Z 54 (EPSG:28354).

My MapBasic statement is

Commit Table DCDB As "C:\DCDB_Full_Copy.TAB" TYPE NATIVE Charset "WindowsLatin1" CoordSys Earth Projection 8, 116, "m", 141, 0, 0.9996, 500000, 10000000 Bounds (-7745844.29605, 2035.05684549) (8745844.29605, 19997964.9432) Interactive
Update DCDB_Full_Copy Set X = CentroidX(obj)
Update DCDB_Full_Copy Set Y = CentroidY(obj)

It gives me

22N14849 [LotPlan], 141.071716, -17.66865

but it should be

22N14849 [LotPlan], 507606.510877, 8046471.56601

How can I get the coordinates in the correct format?

2

You need to specify the coordinate system to use before extracting the coordinates from the object:

Commit Table DCDB As "C:\DCDB_Full_Copy.TAB" TYPE NATIVE Charset "WindowsLatin1" 
    CoordSys Earth Projection 8, 116, "m", 141, 0, 0.9996, 500000, 10000000 Bounds (-7745844.29605, 2035.05684549) (8745844.29605, 19997964.9432) Interactive

'**Assuming  you want to use the coordinate system of the table
Set CoordSys Table DCDB_Full_Copy

**You can do the update in one statement:
Update DCDB_Full_Copy 
   Set X = CentroidX(obj)
     , Y = CentroidY(obj)

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.