Vector Tiles
You can specify where to load MVTs (which sometimes have .pbf
extension) by creating a TileSet
object with template parameters (for example {z}
which will be replaced with the zoom level).
MapMetrics has a repo with some example vector tiles with the OpenMapTiles schema around Innsbruck, Austria. In the example we load these MVTs and create a line layer for the road network.
kotlin
val tileset = TileSet(
"openmaptiles",
"https://demotiles.mapmetrics.org/tiles-omt/{z}/{x}/{y}.pbf"
)
val openmaptiles = VectorSource("openmaptiles", tileset)
style.addSource(openmaptiles)
val roadLayer = LineLayer("road", "openmaptiles").apply {
setSourceLayer("transportation")
setProperties(
lineColor("red"),
lineWidth(2.0f)
)
}