Main Content


Transform vector map data to new origin and orientation


[lat1,lon1] = rotatem(lat,lon,origin,'forward')
[lat1,lon1] = rotatem(lat,lon,origin,'inverse')
[lat1,lon1] = rotatem(lat,lon,origin,'forward',units)
[lat1,lon1] = rotatem(lat,lon,origin,'forward',units)


[lat1,lon1] = rotatem(lat,lon,origin,'forward') transforms latitude and longitude data (lat and lon) to their new coordinates (lat1 and lon1) in a coordinate system resulting from Euler angle rotations as specified by origin. The input origin is a three- (or two-) element vector having the form [latitude longitude orientation]. The latitude and longitude are the coordinates of the point in the original system, which is the center of the output system. The orientation is the azimuth from the new origin point to the original North Pole in the new system. If origin has only two elements, the orientation is assumed to be 0º. This origin vector might be the output of putpole or newpole.

[lat1,lon1] = rotatem(lat,lon,origin,'inverse') transforms latitude and longitude data (lat and lon) in a coordinate system that has been transformed by Euler angle rotations specified by origin to their coordinates (lat1 and lon1) in the coordinate system from which they were originally transformed. In a sense, this undoes the 'forward' process. Be warned, however, that if data is rotated forward and then inverted, the final data might not be identical to the original. This is because of roundoff and data collapse at the original and intermediate singularities (the poles).

[lat1,lon1] = rotatem(lat,lon,origin,'forward',units) and [lat1,lon1] = rotatem(lat,lon,origin,'forward',units) specify the angle units of the data, where units is any recognized angle unit. The default is 'radians'. Note that this default is different from that of most functions.

The rotatem function transforms vector map data to a new coordinate system.

An analytical use of the new data can be realized in conjunction with the newpole function. If a selected point is made the north pole of the new system, then when new vector data is created with rotatem, the distance of every data point from this new north pole is its new colatitude (90º minus latitude). The absolute difference in the great circle azimuths between every pair of points from their new pole is the same as the difference in their new longitudes.


What are the coordinates of Rio de Janeiro (23ºS,43ºW) in a coordinate system in which New York (41ºN,74ºW) is made the North Pole? Use the newpole function to get the origin vector associated with putting New York at the pole:

nylat = 41; nylon = -74;
riolat = -23; riolon = -43;
origin = newpole(nylat,nylon);
[riolat1,riolon1] = rotatem(riolat,riolon,origin,...

riolat1 =
riolon1 =

What does this mean? For one thing, the colatitude of Rio in this new system is its distance from New York. Compare the distance between the original points and the new colatitude:

dist = distance(nylat,nylon,riolat,riolon)

dist =


ans =

Version History

Introduced before R2006a