Sorry, corrected script:

library(raster)
p <- "+proj=cea +lon_0=Central Meridian +lat_ts=Standard Parallel
+x_0=False Easting  +y_0=False Northing"
r <- projectExtent(raster(), p)
# res(r) <- 10000  # 10 km
res(r) <- 1000000  # 1000 km
r[] <- 1:ncell(r)
plot(r)

library(maptools)
data(wrld_simpl)
w <- spTransform(wrld_simpl, CRS(p))
plot(w, add=T)


On Mon, Oct 1, 2012 at 10:18 AM, Robert J. Hijmans <r.hijmans@gmail.com>wrote:

>
> I believe you can divide the world into equal area grid cells if you use
> an appropriate projection (not UTM !). Below I show how you can do it with
> the "cylindrical equal area" projection:
>
> library(raster)
> p <- "+proj=cea"
> r <- projectExtent(raster(), p)
> # small example, 1000 km cells
> res(ep) <- 1000000
> r[] <- 1:ncell(r)
> plot(r)
>
> library(maptools)
> data(wrld_simpl)
> w <- spTransform(wrld_simpl, CRS(p))
> plot(w, add=T)
>
>
> Robert
>
> On Mon, Oct 1, 2012 at 1:05 AM, Barry Rowlingson <
> b.rowlingson@lancaster.ac.uk> wrote:
>
>> On Mon, Oct 1, 2012 at 8:09 AM, Massimiliano Ruocco <ruocco@idi.ntnu.no>
>> wrote:
>> > Dear all,
>> > i would like to divide the world map in grid of equal dimension (example
>> > quad of 10kmx10km). Is it correct to use the UTM coord instead of
>> > lat/lon ones? Is there any drawback on doing that?
>> >
>> > IS there any existing routine doing it?
>>
>>  Since we figured out that the earth isn't flat we've known its
>> impossible. You can't divide a sphere into a grid like that - what are
>> you going to do at the poles?
>>
>>  You can project small parts to coordinates such as UTM and divide
>> into a regular square grid in those coordinates, but even those aren't
>> perfect, and get less perfect nearer the poles, at which point they
>> are completely wrong...
>>
>> I think UTM zones typically have a max latitude they should be used
>> at, so as long as you don't care about polar bears and penguins you
>> should be okay...
>>
>> Barry
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>

	[[alternative HTML version deleted]]

