maptalks.js

repository·master·Indexed 26 days ago

https://github.com/maptalks/maptalks.js

A WebGL and WebGPU driven 2D/3D map engine designed for high performance and rich 3D features, including support for Vector Tiles, 3DTiles, and GLTF. The ecosystem includes plugins for spatial analysis (Viewshed, Flood, Skyline, Insight, Cut, Excavate, CrossCut, and HeightLimit), a GLTF loader, 3DTiles support via Geo3DTilesLayer, and fusion.gl, a WebGL sandbox library that allows multiple environments to share a single WebGL Context.

Tokens
16.4K
Snippets
27
Records
147
Agent score
89%

What's inside maptalks.js

  1. Overview of fusion.gl

    master

    fusion.gl is a WebGL sandbox library that allows multiple sandbox WebGL environments to share a single WebGL Context. This is useful for integrating different WebGL frameworks (like Three.js) into the same canvas without state conflicts.

    Key features:

    • Simulates full WebGL1 and partial WebGL2 interfaces.
    • Manages state for each individual sandbox WebGLContext.
    • Automatically sets WebGL Context states (such as stencil, depth, and blend) when switching between sandboxes.
    • Performance optimization: avoids redundant WebGL state commands if the requested state is already set.
  2. Overview of maptalks features

    master

    maptalks is a lightweight JavaScript library designed for creating integrated 2D/3D maps. Key features include:

    • 2D/3D Integration: Seamlessly handle both 2D and 3D mapping needs.
    • Pluggable Architecture: Easily extend functionality using a wide range of plugins.
    • High Performance: Capable of smoothly rendering tens of thousands of geometries.
    • Server-Side Rendering (SSR): Supports rendering on the server side using Node.js.
    • Simplicity: Designed to be easy to learn and use for most mapping requirements.
  3. Install @maptalks/3dtiles via CDN

    master

    To use the 3dtiles plugin, include the following scripts in your HTML. Note that it requires maptalks and @maptalks/gl as dependencies.

    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/maptalks@next/dist/maptalks.min.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@maptalks/gl/dist/maptalksgl.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@maptalks/3dtiles@latest/dist/maptalks.3dtiles.js"></script>
  4. Install maptalks via CDN

    master

    You can include maptalks directly in your HTML file using a CDN. Ensure you include both the CSS and the JavaScript files.

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.min.css">
    <script src="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.min.js"></script>
  5. Set up development environment for maptalks-gl

    master

    To contribute or debug the codebase, ensure you meet the following requirements:

    • Node.js: Minimum version 18.16.1.
    • Package Manager: pnpm@9.x is currently used.

    Commands

    • Install dependencies: pnpm i
    • Compile project: pnpm build
    • Run in watch/debug mode: pnpm run dev (run this in the root folder of the package you are debugging).
    pnpm i
    pnpm build
    pnpm run dev