GeoScene Maps SDK for .NET 4.1中加载栅格数据,出现了黑色背景。

描述:​该栅格是四波段的,有alpha波段,Pro中加载栅格默认也是有黑色背景的,但是RGB渲染中指定alpha波段为第四波段就正常了,但是Maps SDK for .NET中rgb渲染无法识别alpha波段。
已邀请:

朱新颖

赞同来自:

解决:GeoScene Maps SDK .NET中可以直接使用Mask函数:
 string jsonFunction =
@"{
""raster_function"":{""type"":""Mask_function""},
""raster_function_arguments"":
{
""nodata_values"":{""double_array"":[0],""type"":""Raster_function_variable""},
""nodata_interpretation"":{""nodata_interpretation"":""all"",""type"":""Raster_function_variable""},
""raster"":{""name"":""raster"",""is_raster"":true,""type"":""Raster_function_variable""},
""type"":""Raster_function_arguments""
},
""type"":""Raster_function_template""
}";


RasterFunction rasterFunction = RasterFunction.FromJson(jsonFunction);
// Get the raster function arguments
RasterFunctionArguments rasterFunctionArguments = rasterFunction.Arguments;
// Get the list of raster names from the raster function arguments.
IReadOnlyList<string> rasterNames = rasterFunctionArguments.GetRasterNames();
// Set the local file raster as a raster name argument.
rasterFunctionArguments.SetRaster(rasterNames[0], raster);
// Create a new raster based on the raster function.
Raster rasterWithFunction = new Raster(rasterFunction);
// Create a new raster layer from the raster with function applied.
RasterLayer rasterLayer = new RasterLayer(rasterWithFunction);
await rasterLayer.LoadAsync();
MyMapView.Map.OperationalLayers.Add(rasterLayer);
await MyMapView.SetViewpointGeometryAsync(rasterLayer.FullExtent);

要回复问题请先登录注册