All Projects → iamanvesh → mapbox-gl-draw-circle

iamanvesh / mapbox-gl-draw-circle

Licence: MIT license
Supports drawing/editing a circle on a Mapbox map.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mapbox-gl-draw-circle

react-map-gl-draw
React Component for Mapbox GL Draw
Stars: ✭ 50 (-1.96%)
Mutual labels:  mapbox-gl, mapbox-gl-draw
deck.gl-time-series-widget
A React Time Slider implementation for DECK.GL - (non)temporal data - by CPU filtering ⌛
Stars: ✭ 19 (-62.75%)
Mutual labels:  mapbox-gl
React Mapbox Gl
A React binding of mapbox-gl-js
Stars: ✭ 1,683 (+3200%)
Mutual labels:  mapbox-gl
Osm Liberty
A free Mapbox GL basemap style for everyone
Stars: ✭ 231 (+352.94%)
Mutual labels:  mapbox-gl
Pure Maps
Maps and navigation
Stars: ✭ 136 (+166.67%)
Mutual labels:  mapbox-gl
mapbox-gl-qml
Unofficial Mapbox GL Native bindings for Qt QML
Stars: ✭ 30 (-41.18%)
Mutual labels:  mapbox-gl
Maplibre Gl Native
An open-source fork of Mapbox GL SDK for iOS and Android and other platforms
Stars: ✭ 65 (+27.45%)
Mutual labels:  mapbox-gl
maptalks.mapboxgl
MapboxglLayer for maptalks.js
Stars: ✭ 51 (+0%)
Mutual labels:  mapbox-gl
datahub
Datahub v2
Stars: ✭ 16 (-68.63%)
Mutual labels:  mapbox-gl
Wind Layer
🎏 🚀 wind-layer | a openlayers && amap && bmap && leaflet && mapbox-gl extension to windjs
Stars: ✭ 188 (+268.63%)
Mutual labels:  mapbox-gl
React Native Mapbox Gl
A Mapbox GL react native module for creating custom maps
Stars: ✭ 2,120 (+4056.86%)
Mutual labels:  mapbox-gl
React Mapbox Gl Draw
Draw tools for Mapbox with React: 🗺️ react-mapbox-gl + 🖌️ mapbox-gl-draw
Stars: ✭ 136 (+166.67%)
Mutual labels:  mapbox-gl
atto
PDF renderer for Mapbox-GL-Native
Stars: ✭ 27 (-47.06%)
Mutual labels:  mapbox-gl
Mapbox Gl Native Android
Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
Stars: ✭ 135 (+164.71%)
Mutual labels:  mapbox-gl
Tilejson Spec
JSON format for describing map tilesets.
Stars: ✭ 175 (+243.14%)
Mutual labels:  mapbox-gl
Osmscout Server
Maps server providing tiles, geocoder, and router
Stars: ✭ 105 (+105.88%)
Mutual labels:  mapbox-gl
Ngx Mapbox Gl
Angular binding of mapbox-gl-js
Stars: ✭ 248 (+386.27%)
Mutual labels:  mapbox-gl
who-owns-what
Who owns what in nyc?
Stars: ✭ 146 (+186.27%)
Mutual labels:  mapbox-gl
mapbox-gl
Polymer 2.0 custom element for mapbox-gl-js. Uses WebGL to render interactive maps from vector tiles and Mapbox styles - compatible with deck-gl.
Stars: ✭ 24 (-52.94%)
Mutual labels:  mapbox-gl
odoviz
3D Odometry Visualization and Processing Tool
Stars: ✭ 24 (-52.94%)
Mutual labels:  mapbox-gl

mapbox-gl-draw-circle

Adds support for drawing and editing a circle feature using mapbox-gl-draw library.

Demo

Circle mode

Circle Mode Demo

Drag Circle mode

Drag Circle Mode Demo

Usage

Installation

npm install mapbox-gl-draw-circle
import {
    CircleMode,
    DragCircleMode,
    DirectMode,
    SimpleSelectMode
} from 'mapbox-gl-draw-circle';


// userProperties has to be enabled
const draw = new MapboxDraw({
  defaultMode: "draw_circle",
  userProperties: true,
  modes: {
    ...MapboxDraw.modes,
    draw_circle  : CircleMode,
    drag_circle  : DragCircleMode,
    direct_select: DirectMode,
    simple_select: SimpleSelectMode
  }
});

// Add this draw object to the map when map loads
map.addControl(draw);

The default radius units are in kilometers and initial radius is 2km.

// Provide the default radius as an option to CircleMode
draw.changeMode('draw_circle', { initialRadiusInKm: 0.5 });

It fires the same events as the mapbox-gl-draw library. For more information follow this link.

Sample feature object returned in draw.create event

{
  "id": "e184898e58feaa5c2c56f20a178ffe2c",
  "type": "Feature",
  "properties": {
    "isCircle": true,
    "center": [
      -0.2472604947478203,
      51.53200220026099
    ],
    "radiusInKm": 2
  },
  "geometry": {
    "coordinates": [], // populated with 64 vertices used to render the circle
    "type": "Polygon"
  }
}

Changelog

v1.1.0

  • Added a new DragCircle mode.
  • Fixed issue (#5), where the polygon mode was not working when used along with CircleMode.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].