R/mercator.R

Defines functions mercator

Documented in mercator

mercator <-
function(lat, lon, scale = "km", b0 = 65)
{
	radius <- 6378.388
	m.p.km <- 1.852
	mult <- radius
	if(scale != "km")
		mult <- mult/m.p.km
	l1 <- (lon * pi)/180
	b1 <- (lat * pi)/180
	b0 <- (b0 * pi)/180
	x <- mult * cos(b0) * l1
	y <- mult * cos(b0) * log((1 + sin(b1))/cos(b1))
	return(invisible(list(lat = lat, lon = lon, x = x, y = y, scale = scale,
		projection = "mercator", b0 = b0, L0 = NULL)))
}

Try the geo package in your browser

Any scripts or data that you put into this service are public.

geo documentation built on May 2, 2019, 5:22 p.m.