Class MvtTileSource

java.lang.Object
com.codename1.maps.vector.HttpTileSource
com.codename1.maps.vector.MvtTileSource
All Implemented Interfaces:
TileSource

public final class MvtTileSource extends HttpTileSource

A networked MVT (Mapbox Vector Tile) source. Point it at any {z}/{x}/{y}.pbf/.mvt endpoint (MapLibre/OpenMapTiles, Protomaps, MapTiler, ...). Most hosted vector basemaps require an API key, supplied through HttpTileSource.setApiKey(String) and referenced as {key} in the URL.

For a keyless, self-hostable basemap, Protomaps .pmtiles served behind a z/x/y proxy works well; for fully offline maps use BundledTileSource.

  • Constructor Details

    • MvtTileSource

      public MvtTileSource(String urlTemplate, int minZoom, int maxZoom)
      Creates a vector source from a {z}/{x}/{y} URL template.
  • Method Details

    • openFreeMap

      public static MvtTileSource openFreeMap()
      The free, keyless OpenFreeMap vector basemap, built from OpenStreetMap data. No API key or sign-up is required. Its tile URLs are versioned, so the source is given OpenFreeMap's TileJSON URL (no {z} token) and resolves the current tile template from it on first use. Works out of the box with MapStyle.light() / MapStyle.dark().