Set CoordSys statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Sets the coordinate system used by MapBasic. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Set CoordSys...

CoordSys... is a coordinate system clause.

Description

The Set CoordSys statement sets MapBasic's coordinate system. 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. 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.

The Set CoordSys statement does not affect a Map window. To set a Map window's projection or coordinate system, you must issue a Set Map...CoordSys statement.

The CoordSys clause has optional Table and Window sub-clauses that allow you to reference the coordinate system of an existing table or window. See CoordSys clause for more information.

Example

The following Set CoordSys statement would set the coordinate system to an un-projected, Earth-based system.

Set CoordSys Earth 

The next Set CoordSys statement would set the coordinate system to an Albers equal-area projection.

Set CoordSys Earth 
Projection 9,7,"m",-96.0,23.0,20.0, 60.0, 0.0, 0.0

The Set CoordSys statement below prepares MapBasic to work with objects from a Layout window. You must use a Layout coordinate system before querying or creating Layout objects.

Set CoordSys Layout Units "in" 
Note: Once you have issued the Set CoordSys Layout statement, the MapBasic program will continue to use the Layout coordinate system until you explicitly change the coordinate system back. Subsequently, you should issue a Set CoordSys Earth statement before attempting to query or create any objects on Earth maps.

See Also:

CoordSys clause, Set Area Units statement, Set Distance Units statement, Set Paper Units statement