[R-sig-Geo] Mollweide Raster projection

Robert J. Hijmans r.hijmans at gmail.com
Tue Oct 15 06:51:31 CEST 2013


Daniel,

You can fix this with the "over" argument

grid_moll<-projectRaster(grid, crs=moll_crs, over=T)

On Mon, Oct 14, 2013 at 1:17 PM, Daniel Varajão de Latorre
<danielvdelatorre at gmail.com> wrote:
> Hi all,
>
> I've been trying to use mollweide projection on a raster of the world and
> something is going weird.
> The problem (which can be seen in the plot) is that there are cells out of
> the map bounds (extent?).
> Probably due to the warning I get on the projectRaster() function:
>
> In rgdal:::.gd_transform(projto_int, projfrom, nrow(xy), xy[, 1],  :
>   3730 projected point(s) not finite
>
> I used the following code:
>
> library(raster)
> library(mapproj)
> library(maptools)
> library(rgdal)
> data(wrld_simpl)
>
> r<-raster(nrows=180, ncols=360, xmn=-180, xmx=180, ymn=-90, ymx=90)
> r[]<-1:ncell(r)
>
> r[]<-0
>
> grid<-rasterize(x=wrld_simpl, y=r)
> grid[grid>=1]<-1
> grid[grid==0]<-NA
>
> moll_crs<-"+proj=moll +ellps=WGS84"
> grid_moll<-projectRaster(grid, crs=moll_crs)
> plot(grid_moll)
> plot(wrld_simpl_Mollweide, add=T)
>
> Is there any mistake??
>
> Thanks in advance
> Daniel
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list