Issue
I'm working on mapbox android sdk. I can show our map tiles ( png raster tiles ), but some districts are transparent and in that places mapbox map appears. In another same project with google map i have done this and google has an option that name is :
googleMap.setMapType(GoogleMap.MAP_TYPE_NONE);
that remove the default google map and only show my tiles but there is no option like this in mapbox android and i'm getting surprised that this huge sdk doesn't have this basic option or i couldn't find easily. Is there anyone that can help me to solve this ?
It's good to say that i have removed all of layers and sources and annotations from mapbox then add our own raster tileset :
for (int i = 0; i < mapboxMap.getLayers().size(); i++) {
mapboxMap.removeLayer(mapboxMap.getLayers().get(i));
}
for (int i = 0; i < mapboxMap.getSources().size(); i++) {
mapboxMap.removeSource(mapboxMap.getSources().get(i));
}
for (int i = 0; i < mapboxMap.getAnnotations().size(); i++) {
mapboxMap.removeAnnotation(mapboxMap.getAnnotations().get(i));
}
webMapSource = new RasterSource(
"web-map-source",
new TileSet("tileset", "ourownwebsite.com?" +
"bbox={bbox-epsg-3857}" +
"&service=WMS" +
"&version=1.1.0" +
"&EXCEPTIONS=application/vnd.ogc.se_inimage" +
"&request=GetMap" +
"&layers=test:GSLD256" +
"&width=256" +
"&height=256" +
"&srs=EPSG:3857" +
"&format=image/png"), 256);
mapboxMap.addSource(webMapSource);
// Add the web map source to the map.
RasterLayer webMapLayer = new RasterLayer("web-map-layer", "web-map-source");
mapboxMap.addLayer(webMapLayer);
Solution
You can use either mapboxMap.removeAnnotations()
or mapboxMap.clear()
to remove all annotations from the map.
As for the base layers, the closest to GoogleMap.MAP_TYPE_NONE
would be to set a style which contains only a background layer. To achieve this, call mapboxMap.setStyleJson
with a string containing a style definition similar to this:
{
"version": 8,
"name": "Empty",
"sources": {
},
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "hsl(47, 26%, 88%)"
}
}
],
"id": "empty"
}
Answered By - Tamás Szincsák
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.