Rotate Polygons and Events
Rotate a PolySet (or an EventData set) clockwise by a specified angle around a fixed point.
rotatePolys(polys, angle=40, centroid=c(500,5700), proj.out, zone, xlim=c(-135,-121.5), ylim=c(47,56), plot=FALSE, keep.extra=FALSE, ...) rotateEvents(data, angle=40, centroid=c(500,5700), proj.out, zone, plot=FALSE, keep.extra=FALSE, ...)
polys |
|
data |
|
angle |
|
centroid |
|
proj.out |
|
zone |
|
xlim |
|
ylim |
|
plot |
|
keep.extra |
|
... |
|
Map rotation returns coordinates that are no longer meaningful with respect to the original coordinate system.
When displaying rotated maps, the user might wish to turn off axis labels using xaxt="n"
and yaxt="n"
.
Rotated PolySet or EventData set where 'X'
and 'Y'
are the rotated coordinates in the projection specified by 'proj.out'
.
The returned object has an attribute list object named 'rotation'
that contains:
angle
– angle of clockwise rotation in degrees
radian
– angle of rotation in radians: pi * (-angle)/180
centroid
– fixed point in UTM coordinates (km) around which map is rotated in UTM projection
R
– rotation matrix (2-dimensional)
xylim
– list object to keep track of 'xlim'
, 'ylim'
and a bounding box 'xybox'
.
projection
– projection of the rotated PolySet or EventData set
zone
– zone of the rotated PolySet or EventData set
When keep.extra=TRUE
, the returned object will contain additional fields calculated by the rotational algorithm:
(X0,Y0)
– original coordinates of the input PolySet | EventData set
(uX0,uY0)
– original coordinates converted to UTM (only if original projection is 'LL'
)
(aX,aY)
– UTM coordinates adjusted by subtracting the UTM centroid
(tX,tY)
– adjusted UTM coordinates transformed by multiplying the rotational matrix
(rX,rY)
– rotated UTM coordinates re-centered by adding the UTM centroid
Note:
If proj.out="UTM"
, the coordinates c(rX, rY)
are used as the final rotated coordinates.
If proj.out="LL"
, the coordinates c(rX, rY)
are transformed back into projection 'LL'
as the final rotated coordinates.
Additionally, 'xylim'
in the 'rotation'
list attribute contains intermediary bounding box objects.
For instance, if the input PolySet | EventData object has projection 'LL'
, the 'xylim'
object contains:
LL
– original (X,Y)
limits ('xlim'
, 'ylim'
, 'xybox'
)
UTM
– original (X,Y)
limits transformed to UTM coordinates
rot
– rotated UTM (X,Y)
limits
out
– final projection (X,Y)
limits
The map rotation algorithm is not heavily tested at this time. Report any issues to the package maintainer.
Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Institute of Ocean Sciences (IOS), Sidney BC
Last modified Rd: 2019-03-14
In package PBSmapping:as.PolySet
in PolySet,
clipPolys
,
nepacLL
,
plotMap
,
plotPoints
,
refocusWorld
,
surveyData
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.