这里SDK-栅格层不透明
我正在使用此处的SDK的导航版进行Android。我正在添加自定义的栅格层,我的两个层是透明的(Lite Edition正确显示了这些图层),但是MapView显示了这些图层具有白色背景而不是透明的。这很糟糕,因为白色背景隐藏了基础地图。我是否缺少拥有透明层的东西?
这是我的代码:
private RasterDataSource createRasterDataSource() {
List<Integer> storageLevels = Arrays.asList(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
RasterDataSourceConfiguration.Provider rasterProviderConfig = new RasterDataSourceConfiguration.Provider(
mTemplateUrl,
TilingScheme.QUAD_TREE_MERCATOR,
storageLevels);
String path = "cache/raster/toner";
long maxDiskSizeInBytes = 1024 * 1024 * 32;
RasterDataSourceConfiguration.Cache cacheConfig = new RasterDataSourceConfiguration.Cache(path, maxDiskSizeInBytes);
return new RasterDataSource(mMapView.getMapContext(),
new RasterDataSourceConfiguration(mName, rasterProviderConfig, cacheConfig));
}
private MapLayer createMapLayer() {
MapLayerPriority priority = new MapLayerPriorityBuilder()
.renderedAfterLayer("ocm_cartography")
.build();
MapLayerVisibilityRange range = new MapLayerVisibilityRange(0, 22 + 1);
try {
MapLayer mapLayer = new MapLayerBuilder()
.forMap(mMapView.getHereMap()) // mandatory parameter
.withName(mName + "Layer") // mandatory parameter
.withDataSource(mName, mMapContentType)
.withPriority(priority)
.withVisibilityRange(range)
.build();
return mapLayer;
} catch (MapLayerBuilder.InstantiationException e) {
throw new RuntimeException(e.getMessage());
}
}
mmapContentType是mapconttype.raster_image
I am using the Navigate Edition of HERE SDK for Android. I am adding custom raster layers and two of my layers are transparent (Lite Edition showed the layers correctly), but the MapView shows these layers with a white background instead of transparent. This is bad as the white background hides the underlying map. Am I missing something to have the transparent layer?
Here's my code:
private RasterDataSource createRasterDataSource() {
List<Integer> storageLevels = Arrays.asList(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
RasterDataSourceConfiguration.Provider rasterProviderConfig = new RasterDataSourceConfiguration.Provider(
mTemplateUrl,
TilingScheme.QUAD_TREE_MERCATOR,
storageLevels);
String path = "cache/raster/toner";
long maxDiskSizeInBytes = 1024 * 1024 * 32;
RasterDataSourceConfiguration.Cache cacheConfig = new RasterDataSourceConfiguration.Cache(path, maxDiskSizeInBytes);
return new RasterDataSource(mMapView.getMapContext(),
new RasterDataSourceConfiguration(mName, rasterProviderConfig, cacheConfig));
}
private MapLayer createMapLayer() {
MapLayerPriority priority = new MapLayerPriorityBuilder()
.renderedAfterLayer("ocm_cartography")
.build();
MapLayerVisibilityRange range = new MapLayerVisibilityRange(0, 22 + 1);
try {
MapLayer mapLayer = new MapLayerBuilder()
.forMap(mMapView.getHereMap()) // mandatory parameter
.withName(mName + "Layer") // mandatory parameter
.withDataSource(mName, mMapContentType)
.withPriority(priority)
.withVisibilityRange(range)
.build();
return mapLayer;
} catch (MapLayerBuilder.InstantiationException e) {
throw new RuntimeException(e.getMessage());
}
}
The mMapContentType is MapContentType.RASTER_IMAGE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
得到这里的支持(谢谢!),对于透明的层,我不得不为rasterdatasourceconfiguration.provider设置Hasalphachannel:
Got support from HERE team (thanks!) and for transparent layers I had to set the hasAlphaChannel for the RasterDataSourceConfiguration.Provider: