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

Overlays


The overlay commands include: Overlay Format, Overlay File, Fill Overlay File, Overlay RANGS, Read Overlay File, Overlay XYP File, and Illustrator File.


Overlay Format

This command is used to specify the line thinning of overlay files when using the Overlay File command. All coordinates may be plotted (the default), or a tolerance value, bump angle, # of wedges, and area/perimeter tolerance may be specified to reduce the number of coordinates plotted.
Note: issuing this command may affect subsequent drawing commands by producing line thinning.

Straight line segment may be drawn between actual resultant overlay coordinates (the default), or bezier curves may be interpolated between the coordinates depending on the current Bezier_Curve_Control() parameters.

There are 3 parameters:
tolerance distance- the maximum distance ( in NDC units) a coordinate point may lie from the resultant smoothed line and still be removed.
angle - the minimum angle (_) formed between 3 points which will force a data point to be included in the smoothed line.
wedges - the # of wedges along the smoothed line used to track the created smoothed line.
area/perimeter tolerance - optional ratio of area/perimeter used to remove polygons which are insignficant. Insignificant polygons are considered to be those with higher area/perimeter ratios (default = 0, will ignore this parameter).

Overlay_FormatOverlay Format(tolerance distance,angle,# of wedges [, area/perimeter tolerance]);

Overlay_Format(0.0,20,5); /* keeps all points */
Overlay_Format(mm(1.0),20,5,2); /* reduces the # of points */

initial program state - tolerance of 0.0, keeping all coordinate points


Overlay File

This command is used to draw overlays on the output device. The name of the overlay file is specified. Only valid overlay files (stored as paired files in a binary format) are shown in the file selection window. Typically the overlay files are coastline coordinates and bottom depth contour lines. When output is to the screen, with a mercator projection, special fast versions of the overlay files are used if available.

See Overlay Files for a list of available files.

There are 1 or more parameters:
file name - the name of the overlay file to read.
line number - optional line number(s) specifiy which lines to plot. If a line number is negative, then the coordinates will be plotted in reverse order.

Overlay_File("filename" [,line number...]);

Overlay_File("C:/ Acon/ Overlays/ Coast1");

See the example Data Points and Labels.


Overlay RANGS

This command is used to draw RANGS (Regionally Accessible Nested Global Shorelines) overlays on the output device. The RANGS coordinates are from Rainer Reistel, and are documented in rangs.doc (and other formats available at that web site).

These overlays contain modified WVS (World Vector Shoreline) coordinates converted into GSHHS (Global Self-consistent, Hierarchical, High-resolution Shoreline Database) by WESSEL and SMITH (1996).
The 5 resolutions available were created using the DOUGLAS-PEUCKER (1973) algorithm to derive lower resolution versions (full resolution = 0.1, high = 0.2, intermediate = 1.0 , low = 5.0 and crude = 25 km).

  • Regionally Accessible Nested Global Shorelines (RANGS) are based on the Global Self-consistent Hierarchical High-resolution Shorelines (GSHHS) data set computed by WESSEL and SMITH (1996). Regionally Accessible Nested Global Shorelines (RANGS) have been developed to overcome these disadvantages while preserving the benefits of GSHHS. Like WVS, RANGS is composed of 1°x 1° cells covering the globe. For each cell, the conjunction polygon between the GSHHS polygon and the cell square is computed. All these local RANGS polygons keep a reference to their global GSHHS parent polygons. RANGS polygons then were nested, i.e. it is determined and stored which polygon is the surrounding polygon of a given one, and which polygons are located in the interior of a given polygon. RANGS polygons are stored as additionally generated vertices in conjunction with pointers into GSHHS files.

This command depends on the existance of the RANGS subdirectory (available as a separate file for downloading) in the overlays folder, and on a valid MapPath() function defined in the /engine/systemfns folder (installed by default).

There are 1 or more parameters:
resolution - the resolution of the RANGS coordinates to use
(-1=automatic,
0=highest [.1 km],
1=high [0.2 km],
2=medium [1 km],
3=low [5 km],
4=lowest [25 km]).
Shoreline flag - optional flag indicating that the shoreline line segments are to be drawn (default 1).
Lakes flag - optional flag indicating that the lake line segments are to be drawn (default 1).
Island flag - optional flag indicating that the island line segments are to be drawn (default 1).
land outline colour - optional name of the colour to use to outline land masses(default "BLACK").
land fill colour - optional name of the colour to use to fill land masses(default "WHITE").
lake fill colour - optional name of the colour to use to fill lakes (default "GREY").

Overlay_RANGS(resolution[,shoreline flag,lakes flag,island flag, "land stroke colour","land fill colour","lake fill colour"]);

// Case 3 from the RANGS documentation
data_projection("MERCATOR");
Data_Window(36.90 37.69 11.53 12.41);
overlay_rangs(1, 1, 1, 1, "BLACK", "KHAKI4", "BLUE"); // Shade land and lakes
Axis(1.,1.,0.,0.,1,0,1,0,0);
// A test drawing of Nova Scotia
Function test(resolution) {
RGB_Colour("C0", 53738, 51772, 37354);
RGB_Colour("LIGHT_BLUE", 32767, 32767, 64535);
Line_Colour("RED"); Line_Type(2);
Grid(2,2);
Line_Type(0);
overlay_rangs(resolution, 1, 1, 1, "DARKBROWN", "C0", "LIGHT_BLUE");
Line_Colour("BLACK");
Axis(1.,1.,0.,0.,1,0,1,0,0);
};
Data_window(-68 -57 42 47);
p2 = cat("proj=LEAC lon_0=", str(fabs(ave(getwind(1 2)))), "w lat_1=", str(getwind(3)), "n lat_2=", str(getwind(4)), "n ellps=GRS80 R_A");
Data_projection(p2);
Test(2);

Test 2

// Using the same Test function above with each of the available resolutions...
// for Halifax, N.S.
// Scale at y max is 1:258,082
Data_Window(-63.76,-63.34, 44.5,44.798796);
Data_Viewport(mm(10.), mm(140.), mm(10.), mm(140.));

Test(4);
Test 4

Test(3);
Test 3

Test(2);
Test 2

Test(1);
Test 1

Test(0);
Test 0

The following Data_Dialog functions may be used to browse the RANGS database using the data dialog shown here. Clicking on the map will re-center the map to the location chosen. Clicking on one of the menu items along the bottom of the data_dialog will perform the requested movement, or change the Overlay_RANGS() resolution used.

Data Dialog

Function mapscale()
{ // return the scale for the map at the upper left corner
$xy1 = ndc(getview(1 4));
$xy2 = ndc(getview(1 4) + cm(0 1));
$da = data_distance($xy1[1], $xy1[2], $xy2[1], $xy2[2]);
return(int($da[1;1]*100000));
};
Function plotmap(w,l,r,b,t)
{ // Plot the map and control buttons
Data_Viewport(l+mm(15), r-mm(10), b+mm(10), t-mm(10));
Data_Projection(proj);
$dy = getwind(4) - getwind(3);
$lx = rmin($dy/3);
Grid($lx,$lx);
if (autoscaling) res = -1;
Fill_Grey(0.75);
$start = clock();
Overlay_RANGS(res, 1, 1, 1, "BLACK", ""GOLDENROD", "CADET_BLUE2");
$time = sprintf(" [%.1f sec]", clock() - $start);
Fill_Grey(0);
Axis($lx,$lx,0,0,1,0,1,0,0);
$t = cat(sprintf("RANGS Resolution = %3d ", res), str(getwind(-1 -2 -3 -4)), $time," 1:", str(mapscale()));
if (autoscaling) $t = cat($t," Autoscaling");
Draw_Text(getview(1 4),$t);
// now draw the control buttons
$msg = strfold("LEFT RIGHT DOWN UP IN OUT Res0 Res1 Res2 Res3 Res4 Auto");
Character_Height(pts(10));
for ($i=1;$i<=len($msg)[1];$i++)
{ Draw_text(0.04*($i-1) + .005,0,trim($msg[$i;]));
draw_line(shape(2 2, cat(0, 0.04*($i-1), 0, 0.04*($i-1), 0.015)));
};
draw_line(shape(2 2,cat(0, 0.04*($i-1), 0, 0.04*($i-1), 0.015)));
Draw_Line(shape(2 2,0 0.015 1 0.015));
};
Function onMouseDown(w,l,r,b,t,x,y)
{ // handle each control button, or if clicked on the map, center the map on the point clicked
$w = getwind(1 2 3 4);
$dx = ($w[2]-$w[1]);
$dy = ($w[4]-$w[3]);
if (y < 0.02)
{ $cmd = int(x / 0.04) + 1;
if ($cmd == 1) { $w += (-0.75 -0.75 0 0)*$dx;}; // left
if ($cmd == 2) { $w += (0.75 0.75 0 0)*$dx;}; // right
if ($cmd == 3) { $w += (0 0 -0.75 -0.75)*$dy;}; // down
if ($cmd == 4) { $w += (0 0 0.75 0.75)*$dy;}; // up
if ($cmd == 5) { $w += cat(0,$dx*0.25, $dx*-0.25, $dy*0.25, $dy*-0.25);}; // In
if ($cmd == 6) { $w -= cat(0,$dx*0.25, $dx*-0.25, $dy*0.25, $dy*-0.25);}; // Out
if (($cmd >= 7) && ($cmd <= 11))
{ res = $cmd - 7; // RANGS Resolution
autoscaling = false;
}
if ($cmd == 12) autoscaling = true;
// if ($cmd == 12) proj = "Mercator";
// if ($cmd == 13) proj = cat("proj=LEAC lon_0=", str(fabs(ave(getwind(1 2)))), "w lat_1=", str(getwind(3)), "n lat_2=", str(getwind(4)), ""n ellps=GRS80 R_A");
$w = cat(0, Max(-360,$w[1]), Min(360,$w[2]), Max(-90,$w[3]), Min(90,$w[4]));
}
else if ((x >= getview(1)) && (x <= getview(2)) && (y>= getview(3)) && (y <= getview(4)))
{ // move so that the point that was clicked is now the center of the map
$xy = ndc(x,y);
$w = cat(0,$xy[1]-$dx/2, $xy[1]+$dx/2, $xy[2]-$dy/2, $xy[2]+$dy/2);
}
Data_Window($w);
status_msg(str(cat(0, l, r, b, t, x, y, getwind(1 2 3 4))));
};
Function Onmousestilldown(w, l, r, b, t, mx, my) {};
Function OnMouseup(w, l, r, b, t, mx, my) {};
res = 4; autoscaling = true;
Data_window(-67 -62 41 45);
proj = "Mercator";
Fill_Colour("GREEN");
w=Data_Dialog(4, "plotmap", $null, "onMouseDown", "onMouseStillDown", "onMouseUp");
Data_Dialog_Position(w,0,0,510,350)

Fill Overlay File

This command is used to draw overlays on the output device. The name of the overlay file is specified. Only valid overlay files (stored as paired files in a binary format) are shown in the file selection window. Typically the overlay files are coastline coordinates and bottom depth contour lines. These overlays will contain clipped filled polygons (e.g. the coastal landmass will be shaded).

There is 1 parameter:
file name - the name of the overlay file to read.

Fill_Overlay_File("filename");

Fill_Overlay_File("C:/Acon/Overlays/Coast1");

Read Overlay File

This command is used to read overlay file lines into memory. The name of the overlay file is specified. Only valid overlay files (stored as paired files in a binary format) are shown in the file selection window. Typically the overlay files are coastline coordinates and bottom depth contour lines.

The matrix returned is an n x 2 matrix containing the x,y coordinates of the overlay lines. If the line number is negative, the coordinates are returned in reverse order. If line '0' is specified, then the header record is returned as an n x 4 matrix of min x, max x, min y, max y for each of the lines stored on the file (1 row per line segment).

There are 2 or more parameters:
file name - the name of the overlay file to read.
line number - optional line number(s) specify which lines to plot.

matrix = Read_Overlay_File("filename", line number...);

xy = Read_Overlay_File("C:/Acon/Overlays/Coast1", 1, 2);
len(xy);
97 2

Overlay xyp File

This command is used to draw overlays on the output device. The name of the overlay file is specified. The Overlay xyp file contains raw x,y coordinates and pen up/down commands in ASCII format. Typically the overlay files are coastline coordinates and bottom depth contour lines. These overlays will be drawn and clipped to the output window. These raw text files may require considerable processing time.

The format for the overlay file is:

<x value>,<y value>,<pen command, 0 or 3 = move, anything else = draw>

e.g.
-67.234,44.567,0 move to this point
-67.232,44.654,1 draw to this point
-67.230,44.843,1 draw to this point

There is 1 parameter:
file name - the name of the overlay file to read.

Overlay_XYP_File("file name");

Overlay_XYP_File("C:/AconInput/My overlay file.xyp");

Illustrator File

This command is used to draw overlays on the output device. The name of the Illustrator 1.1 Encapsulated PostScript (EPSF) file is specified. Only valid EPS or AI files are shown in the file selection window. Typically the Illustrator file contains a base map which has been edited using Illustrator to produce an aesthetically pleasing, technically acceptable map. Producing such a map totally within ACON is difficult or impossible, so importing these EPSF files can save considerable effort.

The Illustrator file is copied to the new Illustrator output file. The Illustrator_Output command must be issued before the Illustrator_File command to select illustrator as the current output device.

Having overlain the Illustrator base map document, usually only the data and titles are required to complete the plot.

There is 1 parameter:
file name - the name of the overlay file to read.

Illustrator_File("file name");

Illustrator_File("C:/AconInput/MyIllustrator base map.ai");

See the example Base Maps.


AconIcon ACON       Home/Topics   |   Commands



Last Modified : 2003-11-19