Class MBSource

  • Direct Known Subclasses:
    GeoJsonMBSource, MediaMBSource, TileMBSource

    public abstract class MBSource
    extends Object
    Wrapper around a JSONObject containing the "sources" in a Mapbox style. Mapbox sources supply data to be shown on the map. The type of source is specified by the "type" property, and must be one of vector, raster, geojson, image, video, canvas.

    "Layers refer to a source and give it a visual representation. This makes it possible to style the same source in different ways, like differentiating between types of roads in a highways layer."

    Internally we use a wtms end-point to refer to the data source:

     "us-states": {
        "type": "vector",
        "url": "https://localhost:8080/geoserver/gwc/service/wmts#us:states"
     }
     
    This is based on the following request for a single file::
    http://localhost:8080/geoserver/gwc/service/wmts?
       REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&
       LAYER=dfs:ne_110m_coastline&STYLE=&TILEMATRIX=EPSG:4326:2&TILEMATRIXSET=EPSG:4326&
       FORMAT=application/x-protobuf;type=mapbox-vector
       &TILECOL=3&TILEROW=1
    See Also:
    https://www.mapbox.com/mapbox-gl-js/style-spec/#sources
    • Field Detail

      • json

        protected final JSONObject json
    • Constructor Detail

      • MBSource

        public MBSource​(JSONObject json)
      • MBSource

        public MBSource​(JSONObject json,
                        MBObjectParser parser)
    • Method Detail

      • getType

        public abstract String getType()
        Type of source.
        Returns:
        One of "vector", "raster", "geojson", "image", "video", "canvas".