Coder Social home page Coder Social logo

maplibre-provider's Introduction

@com-tiles/maplibre-provider

The @com-tiles/maplibre-provider package can be used to access a COMTiles archive hosted on an cloud object storage like AWS S3 directly from the browser.
To display the map tiles from a COMTiles archive based on the MapLibre web mapping library register the MapLibreComProvider before creating a MapLibre map instance.
For how to use the MapLibreComProvider class via the script tag see the following snippet.

<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/@com-tiles/maplibre-provider@latest/dist/maplibreComtProvider.js"></script>

<script>
    comtiles.MapLibreComtProvider.register();
    const map = new maplibregl.Map({
        container: "map",
        style: "http://localhost:4711/assets/style.json",
        center: [0, 0],
        zoom: 0,
    });
</script>

For how to use the MapLibreComProvider class via the import statement see the following snippet.

import  { MapLibreComtProvider } from "@com-tiles/maplibre-provider";

MapLibreComtProvider.register();
const map = new maplibregl.Map({...});

Make sure that the URL of the COMTiles archive is added to the sources list in the style definition (style.json) of the map with a comt:// prefix like in the following example

"test-source": {
    "type": "vector",
    "tiles": [
      "comt://http://0.0.0.0:9000/comtiles/test.comt/{z}/{x}/{y}"
    ]
    "maxzoom": 14
}

Per default the individual tile requests get batched to improve performance and in particular to reduce the storage costs.
This can reduce the number of tile requests up to 90%.
To disable this optimization create the MapLibreComtProvider with the following options

MapLibreComtProvider.register(TileContent.MVT, TileFetchStrategy.SINGLE);

The @com-tiles/maplibre-provider package has currently the following limitations regarding the support of the COMTiles specification

  • The only supported TileMatrixCRS is WebMercatorQuad
  • Only Mapbox vector tiles are supported as content of a map tile and no raster formats (PNG, WebP)
  • The only supported space-filling curve type for the order of the index fragments and tiles is row-major
  • Only index fragments can be loaded after the initial fetch. So with the first initial fetch all the unfragmented part of the index has to be fetched and can't be lazy loaded.

maplibre-provider's People

Contributors

markiearnold avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.