Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Updates WMS source example to fix missing 3rd party satellite imagery #1260

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
public class AddWmsSourceActivity extends AppCompatActivity {

MapView mapView;
private MapView mapView;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand All @@ -43,16 +43,20 @@ public void onMapReady(@NonNull final MapboxMap mapboxMap) {
@Override
public void onStyleLoaded(@NonNull Style style) {

// Add the web map source to the map
style.addSource(new RasterSource(
"web-map-source",
new TileSet("tileset", "https://geodata.state.nj.us/imagerywms/Natural2015?bbox={"
+ "bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&"
+ "srs=EPSG:3857&width=256&height=256&layers=Natural2015"), 256));

// Add the web map source to the map.
style.addLayerBelow(
new RasterLayer("web-map-layer", "web-map-source"), "aeroway-taxiway");

new TileSet("tileset", "https://img.nj.gov/imagerywms/Natural2015?bbox={"
+ "bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:"
+ "3857&transparent=true&width=256&height=256&layers=Natural2015"), 256));

// Create a RasterLayer with the source created above and then add the layer to the map
if (style.getLayer("tunnel-street-minor-low") != null) {
style.addLayerBelow(
new RasterLayer("web-map-layer", "web-map-source"), "tunnel-street-minor-low");
} else {
style.addLayer(new RasterLayer("web-map-layer", "web-map-source"));
}
}
});
}
Expand Down