Giter Club home page Giter Club logo

mapbox-gl-draw-geospatial-tools's Introduction

NPM Develop Release

Mapbox GL Draw Geospatial Tools

Advanced tools for geospatial edit and analysis based on MapboxGL-Draw.

Internally multiple Mapbox GL Draw plugins are used:

An Image showing toolbar

Or, See Example

Install

npm install @map.ir/mapbox-gl-draw-geospatial-tools

or use CDN:

<script src="https://unpkg.com/@map.ir/mapbox-gl-draw-geospatial-tools"></script>

Usage

geospatial-tools provides MapboxDrawPro class, a wrapper for Mapbox Draw so you can use it just like you would use Mapbox Draw.

import mapboxGl from 'mapbox-gl';
import MapboxDrawPro from '@map.ir/mapbox-gl-draw-geospatial-tools';

const map = new mapboxgl.Map({
    container: 'map', // container id
    style: 'mapbox://styles/mapbox/streets-v11',
    center: [-91.874, 42.76], // starting position
    zoom: 12, // starting zoom
});

const draw = new MapboxDrawPro(option);

MapboxDrawPro supported all options and methods of MapboxGL-Draw

See API.md for complete reference.

also, you can customize options of internally used plugins which are as below in default:

{
    userProperties: true,
    // aditional-tools
    union: true,
    copy: true,
    buffer: true,
    bufferSize: 0.5,
    bufferUnit: 'kilometers',
    bufferSteps: 64,
    length: true,
    lengthUnit: 'kilometers',
    showLength: true,
    area: true,
    showArea: true,

    // snap-mode
    snap: true,
    snapOptions: {
        snapPx: 15,
        snapToMidPoints: true,
    },
    guides: false,
}

License

MIT © map-ir

mapbox-gl-draw-geospatial-tools's People

Contributors

mhsattarian avatar reyhanemasumi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mapbox-gl-draw-geospatial-tools's Issues

Uncaught ReferenceError: require is not defined

My project is written with Vue3 and vite, and when using CDN to access this tool, there will be the following error:Uncaught ReferenceError: require is not defined.this is my code:
<script src="https://unpkg.com/@map.ir/mapbox-gl-draw-geospatial-tools"></script>
image

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.