[R-sig-Geo] Problem Raster Overlay

Robert J. Hijmans r.hijmans at gmail.com
Tue May 28 02:06:01 CEST 2013


Mohgli,
This should fix it:

library(raster)
r <- raster(FileNm)
r <- rotate(r)

Robert

On Thu, May 23, 2013 at 3:55 PM,  <mohglimoor at gmail.com> wrote:
> Dear all
>
> I am plotting a raster dataset derived through a netCDF file and want to
> overlay with a shapfile. Although I specify the extent of the raster
> xmin=-180 to xmax=180 it puts the x values to 0 to 360. When I then do the
> overlay with a shapefile the shapefiles are shifted since the has an extent
> from -180 to 180.
>
> <ncid <- open.ncdf(FileNm)
> <
> <NetCDFRaster<-raster(FileNm, xmn=-180, xmx=180, ymn=-90, ymx=90,
> ncols=1440, nrows=400)
> <
> <plot(NetCDFRaster)
> <
> <testint <- mask(NetCDFRaster, Worldshapes)
>
> How can I adjust the raster extent to match the extent of the shapefile?
>
> Thanks for any support.
> Best regards,
> Mohgli
>
>         [[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