recenter.Map {TeachingDemos} | R Documentation |
Most maps are centered at a longitude of 0 with points of east longitude plotted on the right side of the map and points with west longitude plotted to the left. This function transforms the points to have a new center moving polygons from the right to left or left to right.
recenter.Map(Map, center = 0, range = c(-180, 180))
Map |
A Map object from the maptools package. |
center |
The new longitude to use as the center. |
range |
The range of possible longitudes on the original scale. |
Plotting a map of the United States can place some of the Alaskan islands to the far right of the map (they have east longitude). This function shifts the longitudes to bring the seperate pieces together.
Polygons will only be shifted if all points can move together, it will not split a polygon between sides of the map.
An object of class Map
(from the maptools package) that is a
copy of the input Map but with the longitudes shifted.
This is beta level software and will probably be superceded by
the spproj
or sp
packages. The function plot.Map
has
been depricated, use plot.polylist
instead (use Map2poly
to convert).
Greg Snow greg.snow@intermountainmail.org
plot.polylist
## Not run: ## this assumes that the time zone shape files have been downloaded ## from: http://openmap.bbn.com/data/shape/timezone/ ## and the US states map (st99_d00) files have been downloaded from ## http://www.census.gov/geo/www/maps/ us <- read.shape('st99_d00') tz <- read.shape('WRLDTZA') plot(Map2poly(us)) plot(Map2poly(recenter.Map(us,-100))) plot(Map2poly(recenter.Map(tz,-165))) ## End(Not run)