<div dir="ltr"><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">Projecting a bathymetric dataset spanning the antimeridian as a raster fails for negative longitudes.</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">This example is from the marmap vignette.</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif">> aleu <- getNOAA.bathy(165, -145, 50, 65, resolution = 5, </font>antimeridian = TRUE)<br></div><div class="gmail_default" style=""><span style="font-family:'trebuchet ms',sans-serif">> summary(aleu)</span><br></div><div class="gmail_default" style=""><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif">Bathymetric data of class 'bathy', with 599 rows and 180 columns</font></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif">Latitudinal range: 50.04 to 64.96 (50.04 N to 64.96 N)</font></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif">Longitudinal range: 165.04 to 214.96 (165.04 E to 145.04 W)</font></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif">Cell size: 5 minute(s)</font></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif"><br></font></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif">Depth statistics:</font></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif"> Min. 1st Qu. Median Mean 3rd Qu. Max. </font></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif"> -7560 -3836 -335 -1832 -7 4374 </font></div><div style="font-family:'trebuchet ms',sans-serif">...</div><div style="font-family:'trebuchet ms',sans-serif">> aleu.r.geo<-marmap::as.raster(aleu) ## Coerce to a raster<br></div></div><div class="gmail_default" style=""><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">> aleu.r.geo ## Summary of raster shows that all coordinates longitudes are positive.<br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">class : RasterLayer </div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">dimensions : 180, 599, 107820 (nrow, ncol, ncell)</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">resolution : 0.08333333, 0.08287037 (x, y)</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">extent : 165.0417, 214.9583, 50.04167, 64.95833 (xmin, xmax, ymin, ymax)</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 </div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">data source : in memory</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">names : layer </div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">values : -7560, 4374 (min, max)</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">## Here is my trouble: I wish to project the rater bathymetry to a local coordinate system.</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><div class="gmail_default">> 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</div><div class="gmail_default">> aleu.r<-projectRaster(from=aleu.r.geo, res=20000, crs=prj.StudyArea, method="bilinear", over=FALSE)</div><div class="gmail_default">> aleu.r</div><div class="gmail_default">class : RasterLayer </div><div class="gmail_default">dimensions : 104, 185, 19240 (nrow, ncol, ncell)</div><div class="gmail_default">resolution : 20000, 20000 (x, y)</div><div class="gmail_default">extent : -1854207, 1845793, -652276.3, 1427724 (xmin, xmax, ymin, ymax)</div><div class="gmail_default">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 </div><div class="gmail_default">data source : in memory</div><div class="gmail_default">names : layer </div><div class="gmail_default">values : -7343.845, 1255.485 (min, max)</div><div><br></div><div>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).</div><div>Yet, a plot of the project raster reveals that the eastern half (the region east of the antimeridian) is missing.</div></div><div class="gmail_default" style=""><font face="trebuchet ms, sans-serif"><div class="gmail_default">> plot(aleu.r) ## Plot image pasted below.</div><div class="gmail_default"><br></div><div class="gmail_default">Is there a trick to getting this right, without introducing missing data at the antimeridian?</div><div><img src="cid:ii_1543f98d374b4ec5" alt="Inline image 1" width="563" height="323"><br></div></font></div></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div><div class="gmail_signature"><span style="color:rgb(19,79,92)">Anthony Fischbach, Wildlife Biologist</span><br><div><div><a href="http://alaska.usgs.gov/science/biology/walrus/" target="_blank">http://alaska.usgs.gov/science/biology/walrus/</a><br></div></div></div></div>
</div>