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

    Interface MapOptions

    Map MapOptions

    User defined configuration options for the map.

    At a minimum, you probably want to define a StyleDefinition and an HTML element container.

    ex.

    import { S2Map } from 's2maps-gpu'; // or you can access it via the global `window.S2Map`
    import type { MapOptions, StyleDefinition } from 's2maps-gpu';

    // build a style guide of sources to fetch and layers to render
    const style: StyleDefinition = { ... };
    // setup options for the map
    const options: MapOptions = {
    container: 'map', // the ID of the HTML element to render the map into
    // reference a canvas instead of a container:
    // canvas: userPulledCanvasElement
    style,
    }
    // Build the map
    const map = new S2Map(options);
    • contextType: [See GPUType] Forces the use of specific GPU Context:
      • 1: WebGL
      • 2: WebGL2
      • 3: WebGPU
    • offscreen: Support OffscreenCanvas
    • canvas: Reference a canvas instead of a container
    • container: Can be a reference to an ID (string) or an HTMLElement
    • style: [See StyleDefinition] Either the style definition or a string URL pointing to the location of the style definition
    • canvasMultiplier: Control the number of fragments per pixel. [default: window.devicePixelRatio]
    • darkMode: boolean flag. Enable dark mode. [default: false]
    • interactive: boolean flag. If true, the map will be interactive with user mouse/keyboard/finger inputs; [default: true]
    • scrollZoom: boolean flag. If true, allow user to use scroll wheel to zoom. [default: true]
    • positionalZoom: boolean flag. If true, cursor position impacts zoom's x & y directions. [default: true]
    • controls: boolean flag. If true, enable default controls; [default: true]
    • zoomController: boolean flag. Display zoom controller state. [default: true]
    • compassController: boolean flag. Display compass controller state. [default: true]
    • colorblindController: boolean flag. Display colorblind controller state. [default: true]
    • canZoom: boolean flag. Enable zooming functionality. [default: true]
    • canMove: boolean flag. Enable panning/moving functionality. [default: true]
    • noClamp: boolean flag. Allow latitude and longitude to pass their limits (-90, 90) and (-180, 180) respectively [default: false]
    • hash: If true, the map will update the URL Hash with it's current View. [default: false]
    • apiKey: string. API key for the map service.
    • urlMap: [See UrlMap] An API URL that remaps any source strings that start with "example://" to whatever example is
      • example: { "apiURL": "https://api.opens2.com" }
    • attributions: Set additional attributions to be displayed on the map.
      • example: { "OpenS2": "https://opens2.com/data" }
    • attributionOff: boolean flag. Disable attribution display. [default: false]
    • watermarkOff: boolean flag. Disable watermark display. [default: false]
    interface MapOptions {
        apiKey?: string;
        attributionOff?: boolean;
        attributions?: Attributions;
        canMove?: boolean;
        canvas?: HTMLCanvasElement;
        canvasMultiplier?: number;
        canZoom?: boolean;
        colorblindController?: boolean;
        compassController?: boolean;
        container?: string | HTMLElement;
        contextType?: GPUType;
        controls?: boolean;
        darkMode?: boolean;
        hash?: boolean;
        interactive?: boolean;
        noClamp?: boolean;
        offscreen?: false;
        positionalZoom?: boolean;
        scrollZoom?: boolean;
        style: string | StyleDefinition;
        urlMap?: UrlMap;
        watermarkOff?: boolean;
        zoomController?: boolean;
    }
    Index

    Properties

    apiKey?: string

    An API key will ensure control and ownership over data

    attributionOff?: boolean

    Hide the attribution tag. [default: false]

    attributions?: Attributions

    Set attributions for data. { [name: string]: URL string }

    ex.

    {
    "OpenS2": "https://opens2.com/data"
    }
    canMove?: boolean

    allow the user to move the map. [default: true]

    Reference a canvas instead of a container

    canvasMultiplier?: number

    Control the number of fragments per pixel. [default: window.devicePixelRatio]

    canZoom?: boolean

    allow the user to zoom the map. [default: true]

    colorblindController?: boolean

    Display a colorblind controller state. [default: true]

    compassController?: boolean

    Display a compass controller state. [default: true]

    container?: string | HTMLElement

    Can be a reference to an ID (string) or an HTMLElement

    contextType?: GPUType

    Forces the use of specific GPU Context:

    • 1: WebGL
    • 2: WebGL2
    • 3: WebGPU
    controls?: boolean

    zoom, compass, and colorblind turned on or off. [default: true]

    darkMode?: boolean

    display controls, info icon, etc. in a dark style. [default: false]

    hash?: boolean

    If true, the map will update the URL Hash with it's current View. e.g. https://opens2.com/example/map#lon=0&lat=0&zoom=0&pitch=0&bearing=0 [default: false]

    interactive?: boolean

    If true, the map will be interactive with user mouse/keyboard/finger inputs; [default: true]

    noClamp?: boolean

    Alow latitude and longitude to pass their limits (-90, 90) and (-180, 180) respectively. [default: false]

    offscreen?: false

    Support OffscreenCanvas

    positionalZoom?: boolean

    If true, cursor position impacts zoom's x & y directions. [default: true]

    scrollZoom?: boolean

    If true, allow user to use scroll wheel to zoom. [default: true]

    style: string | StyleDefinition

    Either the style definition or a string URL pointing to the location of the style definition

    urlMap?: UrlMap

    An API URL that remaps any source strings that start with "apiURL://" to whatever apiURL is

    ex.

    {
    "apiURL": "https://api.opens2.com",
    "baseURL": "https://opens2.com"
    }
    watermarkOff?: boolean

    Hide the logo. [default: false]

    zoomController?: boolean

    Display a zoom controller state. [default: true]