Description Usage Details Value Author(s) See Also Examples
Obtain map boundaries of Canada, USA, and Mexico, including state boundaries, in longitude/latitude.
1 |
This function depends on the maps and mapdata
packages to get the appropriate map boundary lines. The function uses
the high-resolution boundaries (“worldHires” database) in the
mapdata to find the coastlines and national boundaries for
Canada, the USA, and Mexico. Then, it appends the state boundaries
(in “state” from the maps package), removing the
coastlines and national boundaries so that they don't conflict with
the higher-resolution ones (from “worldHires”). This allows the
user to draw the national and state boundaries with high-resolution
and without with conflicting boundaries yielded by the “world”
database. This function is intended to be called by the function
get.map.lines.M3.proj
; in practice, it would rarely be
called directly by the user.
Matrix specifying the polylines needed to plot the national (Canada, USA, Mexico) and state outlines. This matrix has two columns, with longitude in the first column and latitude in the second.
Jenise Swall
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Set up a plotting region (in longitude/latitude) that includes an
## eastern portion of the Canada/USA border.
plot(c(-82,-67), c(39,49), type="n", xlab="Longitude", ylab="Latitude")
## Superimpose national boundaries from "world" database, which is
## fairly low-resolution (since it includes worldwide national boundaries).
map("world", regions="canada", add=TRUE)
## Now, if we try to superimpose the the USA state boundaries from the
## higher resolution "state" database, we have a conflict. (See
## particularly the Maine border.)
map("state", add=TRUE, col="blue")
## The high-resolution national boundaries in database "worldHires" (in
## mapdata) also don't match up with the state lines.
map("worldHires", add=TRUE, col="magenta")
## Instead, we get the national boundaries (Canada, USA, Mexico) at
## high-resolution from database "worldHires" and the state boundaries
## (without the coastlines and national boundaries) from the "state"
## database.
dev.new()
plot(c(-82,-67), c(39,49), type="n", xlab="Longitude", ylab="Latitude")
lines(get.canusamex.bds())
|
Loading required package: ncdf4
Loading required package: rgdal
Loading required package: sp
rgdal: version: 1.2-10, (SVN revision 673)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
Path to GDAL shared files: /usr/share/gdal/1.10
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: (autodetected)
WARNING: no proj_defs.dat in PROJ.4 shared files
Linking to sp version: 1.2-3
Loading required package: maps
Loading required package: mapdata
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.