Application Center - Maplesoft

App Preview:

Maptools package

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

maptools_examples.mws

Maple Maptools example worksheet

by: Vince Costanzo

> restart;

The package files were extracted to w:\maptools on this machine (to execute this worksheet you must change the path below).

Tell Maple where these files are:

> libname := libname, "C:/Program Files/Maple 6/Users/Vincent Costanzo";

libname :=

Now, load maptools:

> with(maptools);

[deg, extract, load, mapplot, mapplot3d]

Next, load the database to be used in creating the plots (to execute the worksheet you must change the path below):

> load("C:/Program Files/Maple 6/Users/Vincent Costanzo/coarse.m");

The maptools package was created by Vince Costanzo while at Villanova University.

The coastal points were obtained from US Geological Survey data at http://rimmer.ngdc.noaa.gov/coast/.

Loading, please be patient . . . 

Database successfully loaded from C:/Program Files/Maple 6/Users/Vincent Costanzo/coarse.m (7470 points)

Define a 2-D function that describes the projection. This is Mercator's map.

> f := (x,y) -> (x, ln(sec(y)+tan(y)));

f := proc (x, y) options operator, arrow; x, ln(sec...

Create a 2-D plot of the projection using mapplot. Maptools only supports arrow functions that map (longitude, latitude) onto Cartesian coordinates (2- or 3-dimensional). Because the poles are mapped to infinite height, restrict the longitude and latitude range. Also, so that the plot looks like a time zone map, change the meridian spacing from its default value to 15 degrees. (Note that the package defines deg as Pi/180 so that 15*deg has the intended meaning).

> mapplot(f, lonlat=[-180*deg..180*deg, -80*deg..80*deg], meridian_spacing=15*deg);

[Maple Plot]

Now create a 3-D projection. This projection maps the longitude and latitude coordinates onto the unit sphere (i.e. it produces a globe). Note that the coastal point databases measure longitude and latitude in a particular way (see ?mapplot or ?mapplot3d), so that the function that is defined must also measure longitude and latitude in the same manner..

> g := (lon,lat) -> (cos(lon)*cos(lat), sin(lon)*cos(lat), sin(lat));

g := proc (lon, lat) options operator, arrow; cos(l...

Plot this function using mapplot3d. Make the parallel spacing 15 degrees and the meridian spacing 30 degrees.

> mapplot3d(g, meridian_spacing=30*deg, parallel_spacing=15*deg);

[Maple Plot]

Finally, if you are strapped for time or computing power, a useful option is to turn the coastline plotting off. For example, to plot only the graticule (gridlines) of Mercator's map:

> mapplot(f, coast=OFF, graticule_color=black, lonlat=[-180*deg..180*deg, -80*deg..80*deg]);

[Maple Plot]

>