Git Product home page Git Product logo

mapbox-gl-draw-circle's People

Contributors

dependabot[bot] avatar iamanvesh 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar

mapbox-gl-draw-circle's Issues

Get Live radius when creating the circle

How to get the liveradius when creating the circle?
When I drag the circle for creating it has to show me the live radius of the circle.
Can anyone please help me with this ASAP.

Errors updating to mapbox-gl-draw to 1.2.0

In recently updated my project mapbox-gl-draw version to 1.2.0, but it causes me errors with mapbox-gl-draw-circle module because its currently using mapbox-gl 1.1.1 version

how to make it work mapbox gl-draw

I have implemented, circlet modes into my mapboxDraw, and I have created a button to call the circle Draw function , but I dont know how to that , what function should I put when "onClick()"
any help please

Circle Customization?

Is there any way to customize the circle? By customization: I mean to change the color. Is there any way as well to disable the creation of circle by click so that I can add multiple circles on the map?

Add circle programmatically

I would like to add a non editable circle with a specified lat/lon and radius programmatically and clicking on the circle should make it editable.
Is this currently possible with this library?

New update: error during compiling in node modules

Hi,

I just updated the packages and received a new error:

/node_modules/mapbox-gl-draw-circle/lib/modes/CircleMode.js
Module parse failed: Unexpected token (6:20)
You may need an appropriate loader to handle this file type.
| const circle = require('@turf/circle').default;
| 
| const CircleMode = {...MapboxDraw.modes.draw_polygon};
| const DEFAULT_RADIUS_IN_KM = 2;
|

In my actual code, I am getting this error when I try to import it:

module "/home/user/workspace/node_modules/mapbox-gl-draw-circle/index" Could not find 
a declaration file for module 'mapbox-gl-draw-circle'. 
'/home/user/workspace/node_modules/mapbox-gl-draw-circle/index.js' implicitly 
has an 'any' type. 

Try `npm install @types/mapbox-gl-draw-circle` if it exists or add a new declaration 
(.d.ts) file containing `declare module 'mapbox-gl-draw-circle';`ts(7016)

I wanted to check and see if I was the only one receiving these errors or if my build somehow got screwed up. I did update the other modules that mapbox-gl-draw-circle uses but it didn't work.

compile failed after installing mapbox-gl-draw-circle Module not found: Error: Can't resolve 'fs'

Hi,
I just add the packages and received error:

ERROR in ../../node_modules/jsonlint-lines/lib/jsonlint.js 692:17-43
Module not found: Error: Can't resolve 'fs' in 'D:\workspace\webapp\node_modules\jsonlint-lines\lib'
 @ ../../node_modules/@mapbox/geojsonhint/lib/index.js 1:15-40
 @ ../../node_modules/mapbox-gl-draw-circle/node_modules/@mapbox/mapbox-gl-draw/src/api.js 6:20-50
 @ ../../node_modules/mapbox-gl-draw-circle/node_modules/@mapbox/mapbox-gl-draw/index.js 3:17-37
 @ ../../node_modules/mapbox-gl-draw-circle/lib/modes/SimpleSelectModeOverride.js 1:19-52
 @ ../../node_modules/mapbox-gl-draw-circle/index.js 4:32-79
 @ ../../src-components/components/BasicMapProvider.tsx 17:0-79 196:21-31 197:21-35 198:23-33  @ ../../src-components/components/FeatureEditor.tsx 12:0-62 92:32-48 99:22-28
 @ ./sentry/overview/index.tsx 3:0-79 70:37-57
 @ ./sentry/overview/route.ts 2:0-30 7:13-21
 @ ./sentry/route.ts 4:0-45 8:129-142
 @ ./route.tsx 6:0-42 17:40-52
 @ ./bootstrap.tsx 6:0-32 80:9-14
 @ ./index.ts 2:0-40 3:0-9

Adding a Static Circle

Is there a way to add a static circle on Mapbox, disallowing the ability to edit it by the user?

Unable to set default radius

import MapboxDraw from "@mapbox/mapbox-gl-draw";
import { CircleMode, DirectMode, DragCircleMode, SimpleSelectMode } from "mapbox-gl-draw-circle";

const draw = new MapboxDraw({
	displayControlsDefault: false,
	defaultMode: "draw_circle",
	userProperties: true,
	modes: {
		...MapboxDraw.modes,
		draw_circle: CircleMode,
		drag_circle: DragCircleMode,
		direct_select: DirectMode,
		simple_select: SimpleSelectMode
	}
});

draw.changeMode("draw_circle", { initialRadiusKm: 0.001 });

leads to the following error: TypeError: Cannot read properties of undefined (reading 'changeMode')

Add draw circle to Map Control

Hello,

I'm looking for how can I add the draw circle control to my map control.

I have this code

const draw = new MapboxDraw({
      displayControlsDefault: true,
      userProperties: true,
      defaultMode: 'draw_circle',
      modes: {
        ...MapboxDraw.modes,
        draw_circle  : CircleMode,
        drag_circle  : DragCircleMode,
        direct_select: DirectMode,
        simple_select: SimpleSelectMode
      }
    });

And when I switch to draw polygon, I can't switch to draw circle again because I don't have it in my Map control
image

Circle with multiple points

After I draw a circle, the feature shows multiple points instead of 4. Also I can't edit because the feature behave like a polygon. What could be wrong?

image

Use as CDN?

Hi!

Is there any way to use this as script link file from CDN? Tried using unpkg.com, but get errors saying that "CircleMode" is undefined.

Issue when using mapbox-gl-draw-circle with Angular 9

Hi,

When using the package with angular 9, it doesn't work, I have this error :

ERROR in ./node_modules/jsonlint-lines/lib/jsonlint.js
Module not found: Error: Can't resolve 'fs' in 'C:\Workspace\COVAL-web\node_modules\jsonlint-lines\lib'

Any help please?

Input data given to 'mapbox-gl-draw-cold' is not a valid GeoJSON object

when I change mode to 'drag_circle'……
image

dependents:

 "@mapbox/mapbox-gl-draw": "^1.1.2",
    "core-js": "^3.6.4",
    "gl-draw-foxgis": "github:wanyanyan/gl-draw-foxgis",
    "mapbox-gl": "^1.10.1",
    "mapbox-gl-draw-circle": "^1.1.1",
    "vue": "^2.6.11",
    "vue-router": "^3.1.6"

vue code:

<template>
  <div class="mapbox">
    <div id="map"></div>
    <button @click="drawCircle">画圆</button>
  </div>
</template>

<script>
import mapboxgl from 'mapbox-gl';
import Draw from '@mapbox/mapbox-gl-draw'
import { CircleMode, DragCircleMode, DirectMode, SimpleSelectMode } from 'mapbox-gl-draw-circle'

mapboxgl.accessToken = 'my token';

export default {
  name: 'mapbox',
  mounted () {
    this.map = null
    this.draw = null
    this.initMap()
  },
  methods: {
    initMap () {
      const map = new mapboxgl.Map({
          container: 'map',
          zoom: 10,
          style: 'mapbox://styles/mapbox/streets-v9'
      });
      map.on('load', () => {
        console.log('load')
        this.map = map
        this.initDraw(map)
      })
    },
    initDraw (map) {
      this.draw = new Draw({
        userProperties: true,
        displayControlsDefault: false,
        modes: {
          ...Draw.modes,
          draw_circle: CircleMode,
          drag_circle: DragCircleMode,
          direct_select: DirectMode,
          simple_select: SimpleSelectMode
        }
      })
      map.addControl(this.draw)
    },
    drawCircle () {
      this.draw.changeMode('drag_circle')
    }
  }
}
</script>

<style scoped lang="stylus">
#map
  height 500px
</style>

Webpack 5 Polyfill + Fs Error on Import

I installed and then imported the modules as shown in the docs. Then the below happened:

ERROR in ./node_modules/jsonlint-lines/lib/jsonlint.js 942:44-69

Module not found: Error: Can't resolve 'path' in '/Users/scientist/Documents/GitHub/msc-project/client/node_modules/jsonlint-lines/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
	- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "path": false }

I also get another error as expressed here.

For people that need this functionality urgently, I recommend mapbox-gl-draw-geodesic. I do have to say though I am confused with the documentation of this one.

Switch between polygons and circle

Hi, I am using both mapbox-gl-draw-circle and mapbox-gl-draw.

I was curious to know if it is possible to switch between circles and polygons without having to alter any code to make it switch. For instance, you could make the polygon button draw a polygon while the marker button draws a circle.

Does anyone know if this is possible? I'm open to any options. Thanks!

Mapbox-gl-draw version update

Is there any update on updating mapbox-gl-draw to a more recent version #27 (comment)? There seems to be an npm audit warning with one of it's dependencies in version 1.1.1. Thank you!

draw_polygon and draw_circle can not use at the same time,they clashed.

I add some draw mode to my program, when user click one type, they can draw corresponding shape on the map. But the 'draw_polygon' mode draw the same shape as 'draw_circle ' mode, can you tell me how to solve this conflicts?

map.on('load', e => {
    // userProperties has to be enabled
    var draw = new MapboxDraw({
        modes: {
            ...MapboxDraw.modes,
            draw_circle: CircleMode,
            direct_select: DirectMode,
            simple_select: SimpleSelectMode,
            draw_rectangle: DrawRectangle,
            lots_of_points: LotsOfPointsMode
        },
        displayControlsDefault: false
    });

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

    window.drawTypeHandler = function(type) {
        switch(type) {
            case 1: draw.changeMode('draw_point');break;
            case 2: draw.changeMode('draw_line_string');break;
            case 3: draw.changeMode('draw_polygon');break;
            case 4: draw.changeMode('draw_rectangle');break;
            case 5: draw.changeMode('draw_circle');break;
        }
    }
});

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.