[R-sig-Geo] coercing marmap bathy object to raster spanning the antimeridian
Fischbach, Anthony
afischbach at usgs.gov
Fri Apr 22 22:14:12 CEST 2016
Projecting a bathymetric dataset spanning the antimeridian as a raster
fails for negative longitudes.
This example is from the marmap vignette.
> aleu <- getNOAA.bathy(165, -145, 50, 65, resolution = 5, antimeridian =
TRUE)
> summary(aleu)
Bathymetric data of class 'bathy', with 599 rows and 180 columns
Latitudinal range: 50.04 to 64.96 (50.04 N to 64.96 N)
Longitudinal range: 165.04 to 214.96 (165.04 E to 145.04 W)
Cell size: 5 minute(s)
Depth statistics:
Min. 1st Qu. Median Mean 3rd Qu. Max.
-7560 -3836 -335 -1832 -7 4374
...
> aleu.r.geo<-marmap::as.raster(aleu) ## Coerce to a raster
> aleu.r.geo ## Summary of raster shows that all coordinates longitudes
are positive.
class : RasterLayer
dimensions : 180, 599, 107820 (nrow, ncol, ncell)
resolution : 0.08333333, 0.08287037 (x, y)
extent : 165.0417, 214.9583, 50.04167, 64.95833 (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : in memory
names : layer
values : -7560, 4374 (min, max)
## Here is my trouble: I wish to project the rater bathymetry to a local
coordinate system.
> prj.StudyArea <- CRS(" +proj=aeqd +lat_0=55 +lon_0=-170 +x_0=0 +y_0=0
+datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 ") #Azimuthal
Equadistant -170, 55
> aleu.r<-projectRaster(from=aleu.r.geo, res=20000, crs=prj.StudyArea,
method="bilinear", over=FALSE)
> aleu.r
class : RasterLayer
dimensions : 104, 185, 19240 (nrow, ncol, ncell)
resolution : 20000, 20000 (x, y)
extent : -1854207, 1845793, -652276.3, 1427724 (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=aeqd +lat_0=55 +lon_0=-170 +x_0=0 +y_0=0 +datum=WGS84
+units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
data source : in memory
names : layer
values : -7343.845, 1255.485 (min, max)
The summary of the projected raster (aleu.r) indicates x coordinates
spanning my study area (from negative to positive values in the
prj.StudyArea CRS).
Yet, a plot of the project raster reveals that the eastern half (the region
east of the antimeridian) is missing.
> plot(aleu.r) ## Plot image pasted below.
Is there a trick to getting this right, without introducing missing data at
the antimeridian?
[image: Inline image 1]
Anthony Fischbach, Wildlife Biologist
http://alaska.usgs.gov/science/biology/walrus/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160422/d45fcf98/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 28957 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160422/d45fcf98/attachment.png>
More information about the R-sig-Geo
mailing list