tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.21k stars 290 forks source link

tangramLayer + marker class #710

Closed meetar closed 5 years ago

meetar commented 5 years ago

This is a WIP branch, introducing new tangramLayer and marker classes, to offer an alternative to Leaflet. This will allow further development of more features currently not supported by Leaflet (or supported only partially, or only through plugins). The ultimate goal is a more powerful and flexible library, with a smaller footprint and fewer dependencies.

src/tangramLayer.js provides a similar public API to the existing leafletLayer API, with a few differences:

import Tangram from '../dist/tangram.debug.mjs';

(function () {
    var scene_url = 'demos/scene.yaml';

    /*** Map ***/

    // Create Tangram map in the element called 'map'
    const map = Tangram.tangramLayer('map', {
        scene: scene_url
    });

    /*** Map ***/

    window.addEventListener('load', () => {
        const options = {
            maxZoom: 20,
            zoomSnap: 0,
            keyboard: false,
            center: { lat: 40.70531887544228, lng: -74.00976419448853 },
        };

        map.initialize(options);

        window.scene = map.scene; // set by tangramLayer

    });
    window.map = map;
}());