Learn R Programming

GEOmap (version 2.5-11)

maplim: Map Limits

Description

Set reasonable map limits from a set of Lat-Lon pairs.

Usage

maplim(lat, lon, pct = 0.1)

Value

list of range of lats and lons

lat

lat limits

lon

lat limits

LON

lon limits modulus 360

lim

vector: lon1 lat1 lon2 lat2

LIM

vector: lon1 lat1 lon2 lat2, with lon limits modulus 360

Arguments

lat

vector of latitudes

lon

vector of longitudes

pct

percent fraction to increase (or decrease) limits

Author

Jonathan M. Lees<jonathan.lees@unc.edu>

Details

In some (GEOmap) programs the longitude needs to be modulus 360, so these are provided also.

See Also

expandbound, plotGEOmapXY

Examples

Run this code

lat = rnorm(10, m=46, sd=2)
lon = rnorm(10, m=-121, sd=1)

M = maplim(lat, lon, pct=.2)

plot(M$lon, M$lat, type='n')
points(lon, lat)

############   plotting with a GEOmap
library(geomapdata)
data(worldmap)

PROJ = setPROJ(type=2, LON0=mean(lon), LAT0=mean(lat))

plotGEOmapXY(worldmap, LIM=M$LIM)
pointsGEOmapXY(lat, lon,PROJ =PROJ,  pch=6)




Run the code above in your browser using DataLab