Skip to content
Back to formatted view

Raw Message

Message-ID: <alpine.LRH.2.00.1201021055310.30459@reclus.nhh.no>
Date: 2012-01-02T09:58:47Z
From: Roger Bivand
Subject: LatLong to UTM zone and coordinates?
In-Reply-To: <4F005D06.6020408@standortsanalyse.net>

On Sun, 1 Jan 2012, Albin Blaschka wrote:

> Am 2012-01-01 12:41, schrieb Albin Blaschka:
>> longitude <- 13.34
>> 
>> UTMzone <- (180 + longitude) / 6
>> UTMzone <- trunc(UTMzone)
>> 
>> UTMzone
>
> Ups, sorry, a little too quick and too dirty this was...
> This should be now the correct answer, still not considering any special 
> cases...
>
> longitude <- seq(-180,180)
> UTMzone <- (180 + longitude) / 6
> UTMzone <- trunc(UTMzone)
> UTMzone <- UTMzone + 1
> UTMzone

Thanks! This gives the zones, and for look-up, you could do:

library(maptools)
brdrs <- seq(-180, 180, 6)
longitude <- seq(-180,180)
# or your data
cbind(longitude, findInterval(longitude, brdrs, all.inside=TRUE))

looking like:

data(wrld_simpl)
plot(wrld_simpl)
abline(v=brdrs)
text(x=brdrs[-1]-3, 0, labels=1:60, col="red")

So the zone would be the output of:

findInterval(<yourLongitudes>, brdrs, all.inside=TRUE)

Roger

>
> Sorry for the noise,
> regards,
> Albin
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no