s2maps-gpu - v0.18.0
    Preparing search index...

    Interface StyleDefinition

    STYLE DEFINITION

    This is the user defined guide for how to render the map. This definition includes directions of what data to render, where to get said data, and how to style each data as layers.

    • projection: [See Projection] "S2" (Spherical Geometry) or "WM" (Web Mercator). Defaults to S2
    • sources: [See Sources] Most critical, a list of source data, how to fetch for rendering
    • timeSeries: [See TimeSeriesStyle] Time series data is a WIP. Is a guide on how to render &/ animate data at various timestamps
    • layers: [See LayerStyle] array of layer definitions, describing how to render the scene
    • glyphs: [See Glyphs] Glyph Data (both fonts and icons) and how to fetch them
    • icons: [See Icons] Icon sources and how to fetch them
    • fonts: [See Fonts] Font sources and how to fetch them
    • sprites: [See Sprites] Sprites sources, where to fetch, can be a string or an object
    • images: Image names and where to fetch them
    • skybox: [See SkyboxStyle] Skybox is often used as a background feature for raster data. Uses a skybox image to render to the screen.
    • wallpaper: [See WallpaperStyle] Wallpaper is often used with vector data. Control the coloring of the background.
    • clearColor: Background color for sections where the painter doesn't draw to. Defaults to rgba(0, 0, 0, 0)
    • view: [See View] zoom, lon, lat, bearing, pitch. Defaults to 0 for all.
    • zNear: zNear is a parameter for the camera. Recommend not touching.
    • zFar: zFar is a parameter for the camera. Recommend not touching.
    • minzoom: The furthest away from the planet you allow
    • maxzoom: The closest to the planet you allow
    • minLatPosition: The minimum latitude position. Useful for the S2 Projection to avoid wonky movemeny at low zooms
    • maxLatPosition: The maximum latitude position. Useful for the S2 Projection to avoid wonky movemeny at low zooms
    • zoomOffset: Often times to improve the quality of raster data, you can apply a zoomOffset for tiles to render.
    • version: version of the style - not used for anything other than debugging
    • name: name of the style - not used for anything other than debugging
    • description: description of the style - not used for anything other than debugging
    • constrainZoomToFill: Strictly a WM Projection property. Force the view to fill. Defaults to false
    • duplicateHorizontally: Strictly a WM Projection property. Render the world map as necessary to fill the screen horizontally. Defaults to true
    • noClamp: Allow the camera to go past the max-min latitudes. Useful for animations. Defaults to false
    • experimental: Enable experimental features
    interface StyleDefinition {
        clearColor?: ColorArray;
        constrainZoomToFill?: boolean;
        description?: string;
        duplicateHorizontally?: boolean;
        experimental?: boolean;
        fonts?: Glyphs;
        glyphs?: Glyphs;
        icons?: Glyphs;
        images?: Record<string, string>;
        layers?: LayerStyle[];
        maxLatPosition?: number;
        maxzoom?: number;
        minLatPosition?: number;
        minzoom?: number;
        name?: string;
        noClamp?: boolean;
        projection?: Projection;
        skybox?: SkyboxStyle;
        sources?: Sources;
        sprites?: Sprites;
        timeSeries?: TimeSeriesStyle;
        version?: number;
        view?: View;
        wallpaper?: WallpaperStyle;
        zFar?: number;
        zNear?: number;
        zoomOffset?: number;
    }
    Index

    Properties

    clearColor?: ColorArray

    background color for sections where the painter doesn't draw to Default is rgba(0, 0, 0, 0) (transparent)

    constrainZoomToFill?: boolean

    Strictly a WM Projection property. Force the view to fill. Defaults to false.

    description?: string

    description of the style - not used for anything other than debugging

    duplicateHorizontally?: boolean

    Strictly a WM Projection property. Render the world map as necessary to fill the screen horizontally. Defaults to true.

    experimental?: boolean

    Utilize WIP experimental components that still have bugs in them.

    fonts?: Glyphs

    Fonts and how to fetch them

    ex.

    "fonts": {
    "robotoMedium": "/api/glyphs-v2/RobotoMedium"
    }
    glyphs?: Glyphs

    Glyph Data (both fonts and icons) and how to fetch them

    ex.

    "glyphs": {
    "robotoMedium": "/api/glyphs-v2/RobotoMedium",
    "streets": "/api/glyphs-v2/streets"
    }
    icons?: Glyphs

    Icons and how to fetch them

    ex.

    "icons": {
    "streets": "/api/glyphs-v2/streets"
    }
    images?: Record<string, string>

    Image names and where to fetch

    ex.

    "images": {
    "pattern": "/images/pattern.jpg"
    layers?: LayerStyle[]

    Layers are the main way to render data on the map. Your layer options are:

    • fill - Draw polygons with a fill color, outline, and opacity
    • glyph - Draw text, icons, sprites, etc.
    • heatmap - Takes lots of points as an input and produces a heatmap
    • hillshade - Draw hillshading on the map given an input elevation tile.
    • line - Lines with variable width, cap, and join types
    • point - Draw individual points, even if they're clustered, deconstruct lines and polygons, etc.
    • raster - RGBA encoded tile data
    • sensor - Sensor data is a temporal construct that takes gridded data and draws it on the map using a color ramp.
    • shade - Draw a nice "shade" gradient on the globe to give it depth if you're using the S2 Projection. Usually only want one.
    maxLatPosition?: number

    The maximum latitude position. Useful for the S2 Projection to avoid wonky movemeny at low zooms

    maxzoom?: number

    The closest you allow the camera to get to the planet

    minLatPosition?: number

    The minimum latitude position. Useful for the S2 Projection to avoid wonky movemeny at low zooms

    minzoom?: number

    The furthest away from the planet you allow

    name?: string

    name of the style - not used for anything other than debugging

    noClamp?: boolean

    Allow the camera to go past the max-min latitudes. Useful for animations.

    projection?: Projection

    Use Either The Web Mercator "WM" or the "S2" Projection. [Default: "S2"]

    skybox?: SkyboxStyle

    Skybox is often used as a background feature for raster data. Uses a skybox image to render to the screen.

    See UrlMap to use your own scheme/protocol for the URL path.

    ex.

    "skybox": {
    "path": "baseURL://backgrounds/milkyway",
    "loadingBackground": "rgb(9, 8, 17)",
    "size": 2048,
    "type": "webp"
    }
    sources?: Sources

    Where to fetch data and JSON guides on how to fetch them. If JSON data, it can be included directly in the source

    ex.

    "sources": {
    "countries": "/s2json/countriesHD.s2json",
    "earthquakes": "/s2json/earthquakes.s2json"
    }
    sprites?: Sprites

    Sprites names and where to fetch

    Sprites have a default expectancy of a png image.

    If you want to use a different format, you can use an object instead of a string.

    See UrlMap to use your own scheme/protocol for the URL path.

    ex.

    "sprites": {
    "streets": "/sprites/streets/sprite@2x"
    }

    ex.

    "sprites": {
    "streets": {
    "path": "/sprites/streets/sprite@2x",
    "fileType": "jpg"
    }
    }
    timeSeries?: TimeSeriesStyle

    Time series data is a WIP. Is a guide on how to render &/ animate data at various timestamps

    version?: number

    version of the style - not used for anything other than debugging

    view?: View

    Set the camera view. Properties include:

    • zoom: the zoom level of the map
    • lon: the longitude of the map
    • lat: the latitude of the map
    • bearing: the bearing/compass of the map camera
    • pitch: the pitch/vertical-angle of the map camera
    wallpaper?: WallpaperStyle

    Wallpaper is often used with vector data. Control the coloring of the background.

    ex.

    "wallpaper": {
    "background": "#030a2d",
    "fade1": "rgb(138, 204, 255)",
    "fade2": "rgb(217, 255, 255)",
    "halo": "rgb(230, 255, 255)"
    }
    zFar?: number

    zFar is a parameter for the camera. Recommend not touching

    zNear?: number

    zNear is a parameter for the camera. Recommend not touching

    zoomOffset?: number

    Often times to improve the quality of raster data, you can apply a zoomOffset for tiles to render.