CoordinateCRS()

Returns specified part (X or Y value) of a coordinate pair transformed from 'WGS84' coordinate system or the coordinate system of your choice to a new coordinate system.

Syntax

CoordinateCRS(double x, double y, string projectTo, string coord)
  • double x: the x-coordinate of the input coordinate pair (in WGS84 coordinate system) to be transformed
  • double y: the y-coordinate of the input coordinate pair (in WGS84 coordinate system) to be transformed
  • string projectTo: string specifying the coordinate system to transform the input coordinates to. projectTo can be an EPSG code ("EPSG:xxxx") or a proj string ("+proj=longlat +datum=NAD27 +no_defs").
  • string coord: string value (either "X" or "Y") indicating the x- or y-coordinate of the coordinate pair to be returned by the transformation

Information about coordinate system EPSG codes can be found here. Information about proj strings and the format can be found here.

Examples

The examples shown here transform a longitude (X)/latitude (Y) coordinate pair from WGS84 (EPSG:4326) to NAD27 (EPSG:4267). Each call to CoordinateCRS() returns either the "X" or the "Y" coordinate of the transformed coordinate pair.

CoordinateCRS(-95.4715, 29.7495, "EPSG:4267", "X")

CoordinateCRS(16.2346, 48.0087, "EPSG:4267", "Y")

CoordinateCRS(16.2346, 48.0087, "+proj=longlat +datum=NAD27 +no_defs", "X")

 

Returns specified coordinate of coordinate pair projected from one coordinate system to another.

Syntax
CoordinateCRS(double x, double y, string projectFrom, string projectTo, string coord)
  • double x: the x-coordinate of the input coordinate pair to be transformed
  • double y: the y-coordinate of the input coordinate pair to be transformed
  • string projectFrom: string specifying the coordinate system of the input coordinates. projectFrom can be an EPSG code ("EPSG:xxxx") or a proj string ("+proj=longlat +datum=NAD27 +no_defs").
  • string projectTo: string specifying the coordinate system to transform the input coordinates to. projectTo can be an EPSG code ("EPSG:xxxx") or a proj string ("+proj=longlat +datum=NAD27 +no_defs").
  • string coord: string value (either "X" or "Y") indicating the x- or y-coordinate to be returned by the transformation

Information about coordinate system EPSG codes can be found here. Information about proj strings and the format can be found here.

Examples

The examples shown here transform a longitude (X)/latitude (Y) coordinate pair from an input coordinate system to anther coordinate system using EPSG codes or proj strings. Each call to CoordinateCRS() returns either the "X" or the "Y" coordinate of the coordinate pair.

CoordinateCRS(-95.4715, 29.7495, "EPSG:4326", "EPSG:4267", "X")

CoordinateCRS(16.2346, 48.0087, "EPSG:4326", "EPSG:4267", "Y")

CoordinateCRS(-95.4715, 29.7495, "+proj=longlat +datum=WGS84 +no_defs",
"EPSG:4267", "X")