我有一个我从Cylindrical Equal-Area(Lambert)Central Meridian重新投射的光栅:-160。基准:WGS 1984([HttpPut]
public JsonResult Put([FromBody]AlunoViewModel vm)
{
if (ModelState.IsValid)
{
var aluno = _context.Alunos
.Single(o => o.Id == vm.Id);
Mapper.Map(vm, aluno);
_context.SaveChanges();
Response.StatusCode = (int)System.Net.HttpStatusCode.OK;
return Json(true);
}
Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
return Json(false);
}
)经度和纬度。
原始栅格看起来像这样:
+proj=cea +lon_0=Central Meridian +lat_ts=Standard Parallel +x_0=False Easting +y_0=False Northing +ellps=WGS84
Original raster without missing points
library(rasterVis)
levelplot(r)
我已经能够使用r
#class : RasterLayer
#dimensions : 64, 200, 12800 (nrow, ncol, ncell)
#resolution : 2e+05, 2e+05 (x, y)
#extent : -20037507, 19962493, -6363885, 6436115 (xmin, xmax, ymin, ymax)
#coord. ref. : +proj=cea +lon_0=-160 +lat_ts=Standard Parallel +x_0=False Easting +y_0=False Northing +ellps=WGS84
#data source : N:\My documents\Data\Exposure\Reefs at risk\Global_Threats\Acidification\arag_380\w001001.adf
#names : w001001
#values : 1.025163, 4.11939 (min, max)
包中的projectRaster
函数,将栅格的y轴范围缩小0.95到北方和南方。我在重新投影栅格时遇到了一些问题而没有削减范围(见这里:https://gis.stackexchange.com/questions/220589/error-using-projectraster-in-r-error-in-if-maxy-miny-missing-value-whe/220741#220741)。
Raster
我遇到的问题是新的重新投影的栅格中缺少数据。
#Cut y-axis values because projectRaster failed using full extent
extent(r) <- c(xmin= -20037507, xmax= 19962493, ymin= 0.95*(-6363885), ymax= 0.95*(6436115))
# Define the new Proj.4 spatial reference
sr <- "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
# Project Raster
projected_r <- projectRaster(r, crs = sr, method = 'bilinear')
reprojected raster with missing points
缺少的坐标不在我从范围内切割的5%North和South中,因此我不确定为什么缺少这些数据?任何帮助将不胜感激!