Resolve issue where feature coordinates are not correct when issued with a MapBasic script



When updating a table with coordinates using a MapBasic® script the used projection by default is Long/Lat WGS84.  This happens even when the table is using a different projection.


By default, MapBasic uses a Longitude/Latitude coordinate system. This means that when geographic functions (such as the CentroidX( ) function and the ObjectNodeX( ) function) return x- or y-coordinate values, the values represent longitude or latitude degree measurements by default. 



UPDATED: December 5, 2019
A MapBasic program can issue a Set CoordSys statement to specify a different coordinate system; thereafter, values returned by geographic functions will automatically reflect the new coordinate system. 

Example: New Zealand Transverse Mercator (NZGD2000), EPSG 2193

Set CoordSys Earth Projection 8, 117, "m", 173, 0, 0.9996, 1600000, 10000000

Note: You can easily find the right Coordsys parameters if you export a table to MID/MIF and then open the MIF file with a text editor.