> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/maps/llms.txt)

# WMS Source

![Add an external WMS source to your map using TileSet API.](https://docs.mapbox.com/android/assets/ideal-img/maps-examples-wms-source.c759313.480.png)

This example demonstrates how to integrate an external [Web Map Service (WMS)](https://www.ogc.org/standards/wms/) layer into a map using the **Mapbox Maps SDK for Android**. The WMS source is added to the map by specifying the WMS source URL, ID, and tile properties using the [`rasterSource`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.extension.style.sources.generated/-raster-source/) method. The app adds a [`RasterLayer`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps.extension.style.layers.generated/-raster-layer/) to display the WMS layer on the map, positioning it either below a specific layer identified by `BELOW_LAYER_ID` or as the base layer if no such layer exists.

> **Note: Android Examples App Available**
> 
> This example code is part of the **Maps SDK for Android Examples App**, a working Android project [available on GitHub](https://github.com/mapbox/mapbox-maps-android/tree/v11.33.0/). Android developers are encouraged to run the examples app locally to interact with this example in an emulator and explore other features of the Maps SDK.
> 
> See our [Run the Maps SDK for Android Examples App](https://docs.mapbox.com/help/tutorials/maps-sdk-android-examples-app/) tutorial for step-by-step instructions.

**Kotlin**

Title: `WmsSourceActivity.kt`

[View on GitHub](https://github.com/mapbox/mapbox-maps-android/blob/v11.33.0/app/src/main/java/com/mapbox/maps/testapp/examples/WmsSourceActivity.kt)

```kt
package com.mapbox.maps.testapp.examples

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.bindgen.Value
import com.mapbox.maps.Style
import com.mapbox.maps.extension.style.layers.addLayer
import com.mapbox.maps.extension.style.layers.generated.RasterLayer
import com.mapbox.maps.extension.style.sources.addSource
import com.mapbox.maps.extension.style.sources.generated.rasterSource
import com.mapbox.maps.testapp.databinding.ActivityWmsSourceBinding

/**
 * Adding an external Web Map Service layer to the map.
 */
class WmsSourceActivity : AppCompatActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val binding = ActivityWmsSourceBinding.inflate(layoutInflater)
    setContentView(binding.root)
    binding.mapView.mapboxMap.loadStyle(
      Style.STANDARD
    ) {
      it.addSource(
        rasterSource(WMS_SOURCE_ID) {
          tileSize(256)
          tileSet(TILESET_JSON, listOf(WMS_SOURCE_URL)) {}
        }
      )
      it.addLayer(RasterLayer(RASTER_LAYER_ID, WMS_SOURCE_ID).slot("bottom"))
      binding.mapView.mapboxMap.setStyleImportConfigProperty("basemap", "theme", Value.valueOf("monochrome"))
    }
  }

  companion object {
    const val WMS_SOURCE_URL = "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"
    const val WMS_SOURCE_ID = "web-map-source"
    const val RASTER_LAYER_ID = "web-map-layer"
    const val TILESET_JSON = "tileset"
  }
}
```