Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada
 
Français Contact Us Help Search Canada Site
Home What's New DFO National Site Map Media

Fisheries & Oceans
 
 
Maritimes Region
Fishing Industry
General Public
Marine & Oceans Industry
Media
Students and Teachers
Scientists and Researchers
 
AconIcon ACON       Home/Topics   |   Commands

Coordinate Conversion


The coordinate conversion commands include: Xuser, Yuser, User, Pts, Inches, Mm, Cm, NDC, and Loran.

All of the following functions (except NDC) accept values in one unit of measure and return the value converted to Normalized Device Units. Normalized Device Units normally range in value from 0.0 to 1.0.

The lower left corner of the output "page" is (0,0) and the upper right corner of a 8.5 x 11 inch page is usually (0.772727,1.0) NDCs.

1.0 NDC = 11 inches = 792 pts = 279.4 mm = 27.94 cm


Xuser

This function converts a numeric value in x axis coordinate units to Normalized Device Units. This function returns a numeric value.

There is 1 parameter:
value - an integer or floating point numeric value (or vector or matrix).

xuser(value);

xuser(-67.5);
0.204804

See the example Filled Arrows

affected by Data_Window(), Data_Viewport(), Data_Projection().


Yuser

This function converts a numeric value in y axis coordinate units to Normalized Device Units. This function returns a numeric value.

There is 1 parameter:
value - an integer or floating point numeric value (or vectoror matrix).

yuser(value);

yuser(42.5);
0.311382

See the example Filled Arrows

affected by Data_Window(), Data_Viewport(), Data_Projection().


User

This function converts numeric values in user units to Normalized Device Coordinates.

There 1 or 2 parameters:
x, y values - integer or floating point numeric value or vectors in user units.
or
matrix - integer or floating point matrix (n x 2) in user units.

User(x,y value);

User(-69.5272 40.2285);
0.1 0.1

affected by Data_Window(), Data_Viewport(), Data_Projection().


User_Proj

This function converts numeric values in user units to Normalized Device Coordinates. This function is identical to the User() function except that if an extended projection is active, additional interpolated values are returned in addition to the original data points.

Note that the actual values returned would be unique for any given projection.

There 1 or 2 parameters:
x, y values - integer or floating point numeric value or vectors in user units.
or
matrix - integer or floating point matrix (n x 2) in user units.

User_Proj(x,y value);

x = -60 -66;
y = 44 48;
// using a simple projection, no intermediate points are returned
Data_projection("MERCATOR");
xyNDCs = user_proj(x,y); // convert to NDC units
Line_Colour("GREEN");
Draw(xyNDCs);
Line_Colour("BLACK");
Axis(1.,1.,0.,0.,1,0,1,0,0);
// using an extended projection, intermediate points are returned
p2 = "proj=MERC lon_0=59.0w lat_ts=44n ellps=clrk66 R_A"; // Mercator
Data_projection(p2);
xyNDCs = user_proj(x,y); // convert to NDC units
Line_Colour("RED");
Draw(xyNDCs);
Line_Colour("BLUE");
xyUser = NDC(xyNDCs); // convert back to lon, lat values
Data_Line(xyUser);
Line_Colour("BLACK");
Axis(1.,1.,0.,0.,1,0,1,0,0);

affected by Data_Window(), Data_Viewport(), Data_Projection().


Pts

This function converts a numeric value in PostScript Printers points (1/72") coordinate units to Normalized Device Units. This function returns a numeric value.

There is 1 parameter:
value - an integer or floating point numeric value (or vector or matrix).

pts(value);

size = pts(12);
size
0.0151515

See the example Data Points and Labels


Inches

This function converts a numeric value in inches to Normalized Device Units. This function returns a numeric value.

There is 1 parameter:
value - an integer or floating point numeric value (or vector or matrix).

inches(value);

size = inches(1);
size
0.0909091


Mm

This function converts a numeric value in mm to Normalized Device Units. This function returns a numeric value.

There is 1 parameter:
value - an integer or floating point numeric value (or vector or matrix).

mm(value);

mm(15.5);
0.055476

See the example Data Points and Labels


Cm

This function converts a numeric value in cm to Normalized Device Units. This function returns a numeric value.

There is 1 parameter:
value - an integer or floating point numeric value (or vector or matrix).

cm(value);

cm(2.5);
0.0894775

NDC

This function converts a numeric value in Normalized Device Coordinates to user units.

There are 1 or 2 parameters:
x, y values - integer or floating point numeric value or vectors(NDC range is from 0 - 1).
or
matrix - integer or floating point matrix (n x 2).

NDC(x,y value);

ndc(0.1,0.1);
-69.5272 40.2285

Loran

This function converts loran C readings to longitude latitude. The original source of the code used in this conversion is unsure, so please confirm your results independently.

There are 6+ parameters:
x reading - floating point numeric value or vector.
x chain - character string or character matrix.
y reading - floating point numeric value or vector.
y chain - character string or character matrix.
x start - floating point numeric value or vector giving a starting estimate for the returned longitude.
y start - floating point numeric value or vector giving a starting estimate for the returned longitude.
method - optional flag indicating the type of loran conversion to use (0 = default, 1 = method used by original lobster data conversion code).

xymatrix = Loran(read1,chain1,read2,chain2,startx,starty,[method]);

Loran(13873.5,"593X",31205.6,"593Y",-65.5,44.9,0)
-65.913163 44.686340


AconIcon ACON       Home/Topics   |   Commands



Last Modified : 2003-11-19