Syntax 1 (Earth Projection)
CoordSys Earth
[ Projection type, datum, unitname
[ , origin_longitude ] [ , origin_latitude ]
[ , standard_parallel_1 [ , standard_parallel_2 ] ]
[ , azimuth ] [ , scale_factor ]
[ , false_easting ] [ , false_northing ]
[ , range ] ]
[ Affine Units unitname, A, B, C, D, E, F ]
[ Bounds ( minx, miny ) ( maxx, maxy ) ]
Syntax 2 (NonEarth Projection)
CoordSys Nonearth
[ Affine Units unitname, A, B, C, D, E, F ]
Units unitname
[ Bounds ( minx, miny ) ( maxx, maxy ) ]
type is a positive integer value representing which coordinate system to use.
datum is a positive integer value identifying which datum to reference.
unitname is a string representing a distance unit of measure (for example, "m" for meters); for a list of unit names, see Set Distance Units statement.
origin_longitude is a float longitude value, in degrees.
origin_latitude is a float latitude value, in degrees.
standard_parallel_1 and standard_parallel_2 are float latitude values, in degrees.
azimuth is a float angle measurement, in degrees.
scale_factor is a float scale factor.
range is a float value from 1 to 180, dictating how much of the Earth will be seen.
minx is a float specifying the minimum x value.
miny is a float specifying the minimum y value.
maxx is a float specifying the maximum x value.
maxy is a float specifying the maximum y value.
A performs scaling or stretching along the X axis.
B performs rotation or skewing along the X axis.
C performs shifting along the X axis.
D performs scaling or stretching along the Y axis.
E performs rotation or skewing along the Y axis.
F performs shifting along the Y axis.
Description
The CoordSys clause specifies a coordinate system, and, optionally, specifies a map projection to use in conjunction with the coordinate system. Note that CoordSys is a clause, not a complete MapBasic statement. Various statements may include the CoordSys clause; for example, a Set Map statement can include a CoordSys clause, in which case the Set Map statement will reset the map projection used by the corresponding Map window.
Use CoordSys Earth (syntax 1) to explicitly define a coordinate system for an Earth map (a map having coordinates which are specified with respect to a location on the surface of the Earth). The optional Projection parameters dictate what map projection, if any, should be used in conjunction with the coordinate system. If the Projection clause is omitted, MapBasic uses datum 0. The Affine clause describes the affine transformation for producing the derived coordinate system. If the Projection clause is omitted, the base coordinate system is Longitude/Latitude. Since the derived coordinates may be in different units than the base coordinates, the Affine clause requires you to specify the derived coordinate units.
Use CoordSys Nonearth (syntax 2) to explicitly define a non-Earth coordinate system, such as the coordinate system used in a floor plan or other CAD drawing. In the CoordSys Non-Earth case, the base coordinate system is an arbitrary Cartesian grid. The Units clause specifies the base coordinate units, and the Affine clause specifies the derived coordinate units.
When a CoordSys clause appears as part of a Set Map statement or Set Digitizer statement, the Bounds subclause is ignored. The Bounds subclause is required for non-Earth maps when the CoordSys clause appears in any other statement, but only for non-Earth maps.
The Bounds clause defines the map's limits; objects may not be created outside of those limits. When specifying an Earth coordinate system, you may omit the Bounds clause, in which case MapInfo Pro uses default bounds that encompass the entire Earth.
Every map projection is defined as an equation; and since the different projection equations have different sets of parameters, different CoordSys clauses may have varying numbers of parameters in the optional Projection clause. For example, the formula for a Robinson projection uses the datum, unitname, and origin_latitude parameters, while the formula for a Transverse Mercator projection uses the datum, unitname, origin_longitude, origin_latitude, scale_factor, false_easting, and false_northing parameters.
For more information on projections and coordinate systems, see the MapInfo Pro documentation.
Each MapBasic application has its own CoordSys setting that specifies the coordinate system used by the application. If a MapBasic application issues a Set CoordSys statement, other MapBasic applications which are also in use will not be affected.
Examples
The Set Map statement controls the settings of an existing Map window. The Set Map statement below tells MapInfo Pro to display the Map window using the Robinson projection:
Set Map CoordSys Earth Projection 12, 12, "m", 0.
The first 12 specifies the Robinson projection; the second 12 specifies the Sphere datum; the "m" specifies that the coordinate system should use meters; and the final zero specifies that the origin of the map should be at zero degrees longitude.
The following statement tells MapInfo Pro to display the Map window without any projection.
Set Map CoordSys Earth
The following example opens the table World, then uses a Commit Table statement to save a copy of World under the name RWorld. The new RWorld table will be saved with the Robinson projection.
Open Table "world" As World
Table world As "RWORLD.TAB"
CoordSys Earth Projection 12, 12, "m", 0.
The following example defines a coordinate system called DCS that is derived from UTM Zone 10 coordinate system using the affine transformation.
x1 = 1.57x - 0.21y + 84120.5
y1 = 0.19x + 2.81y - 20318.0
In this transformation, (x1, y1) represents the DCS derived coordinates, and (x, y) represents the UTM Zone 10 base coordinates. If the DCS coordinates are measured in feet, the CoordSys clause for DCS would be as follows:
CoordSys Earth
Projection 8, 74, "m", -123, 0, 0.9996, 500000, 0
Affine Units "ft", 1.57, -0.21, 84120.5, 0.19, 2.81, -20318.0