Questions tagged [mapbox-gl-draw]

It is a Draw tools for mapbox-gl-js. Draw only works after the Mapbox GL JS map has loaded, so interact with Draw only after your map's load event.

53 questions
2
votes
0 answers

Is there a way to draw different icons for draw points in Mapbox GL js?

In Mapbox GL js, is there a way to draw different draw_point icons in same map. I'm going to add drawing tools and there are different icons. After selecting one icon, the user can be able to draw the map. Ex: user can select tree icon and place…
2
votes
1 answer

How to disable midpoint selection, dragging for LineString types (draw_line_string mode)

How do I disable the ability for a user to select (direct_select) the midpoint of a LineString in mapbox-gl-draw? I have a custom mode for "annotations", which should only allow for LineStrings with 2 vertices. I've tried some of the lifecycle…
allthesignals
  • 307
  • 2
  • 13
2
votes
1 answer

Enable Mapbox Draw control programmatically

Using Mapbox-gl-draw (https://github.com/mapbox/mapbox-gl-draw) I am able to get the basic example up and running, and this package does everything I need. However, I am having trouble figuring out how to activate the draw functionality…
adam3039
  • 1,171
  • 14
  • 27
2
votes
3 answers

Getting error while ng serve. Using mapbox/mapbox-gl-draw

Have following versions: "angular": 6.0.3 "rxjs": "^6.2.0", "@mapbox/mapbox-gl-draw": "^1.0.4", While ng serve Getting error: Could anyone help me out, will be appreciated..
Ketan Akbari
  • 10,837
  • 5
  • 31
  • 51
2
votes
1 answer

mapbox change circle color dynamically when changing property value

I am trying to make mapbox layer to change the color of circles when I change the value a property. But the color of the circle didn`t change. I use mapbox-gl-draw Here the jsbin : https://jsbin.com/lojuwak/edit?html,output Here the style of the…
curvenut
  • 85
  • 2
  • 11
2
votes
0 answers

How to draw a path for user foot steps in MapBox iOS SDK

I am using MapBox API for loading GeoJson data with the file. It's working fine. But, I have to draw a path for user footsteps, like from user current location, if he walks to somewhere in any direction need to draw a path. I have seen RMShape class…
1
vote
1 answer

Why does Mapbox GL's draw_create function fire multiple times under different closures while creating a `LineString?

I am using mapbox-gl-draw in a React.js app to facilitate path creation on a Mapbox canvas. Since I'm in React, I have to declare the draw.create event handler within a useEffect() block. Since my draw.create handler depends on a state variable, I…
SpeedGolfer
  • 255
  • 3
  • 13
1
vote
0 answers

Can't resolve 'fs' after installing mapbox-gl-draw-circle

I'm using this npm library in my react ts project: https://www.npmjs.com/package/mapbox-gl-draw-circle. Because it doesn't support ts I needed to create a declaration file (which I did). But because it uses 'require('./lib/modes/CircleMode') etc. in…
1
vote
0 answers

Mapbox-gl-draw duplicating points on drag when editing linestring from geojson

When I select a point on the map and drag the point to move it, it duplicates the point and creates a new line between the two points surrounding the selected point, which ultimately results in a triangle instead of me being able to just modify the…
1
vote
0 answers

Allow point delete in mapbox draw mod

I am trying to rewrite a MapboxDraw.modes.draw_line_string.clickAnywhere function to allow deletion of a previous point with the SHIFT key in draw_line_string mode. It works, but when it removes the previous point it creates a new one on the new…
SERG
  • 3,907
  • 8
  • 44
  • 89
1
vote
0 answers

How to override js method?

I want to add some custom functionality to DrawLineString method at mapbox/mapbox-gl-draw https://github.com/mapbox/mapbox-gl-draw/blob/main/src/modes/draw_line_string.js I can access this function with…
SERG
  • 3,907
  • 8
  • 44
  • 89
1
vote
0 answers

In Draw control and draw modes starts drawing on map onmouseenter

mapbox-gl-js version: @latest mapbox-gl-draw version: @latest Expected Behavior I add the draw control on map init and I have custom button for multiple draw types. Rectangle, Free Polygon. so in DEV environment drawing works completely fine and…
1
vote
1 answer

React-mapbox-gl-draw error on map startup

I just started using react-mapbox-gl-draw in my react-mapbox-gl application. I am following this very quick demo and their docs to set up the . Seems pretty simple, but I am running into an issue. Here's my code, and the error is…
lve
  • 307
  • 2
  • 5
  • 15
1
vote
2 answers

Add url redirect to mapbox icon

I am trying to allow a mapbox marker to be clicked on and when clicked it automatically takes you to a new link. Is this possible? I currently have a map of 10 locations and when loaded the zoom level shows all. When you click on a location, it…
Andrew
  • 227
  • 1
  • 5
  • 16
1
vote
1 answer

Manually fire the Mapbox-GL-Draw drawing mode

I'd like to use Mapbox-GL-Draw in an app, but want to trigger polygon drawing from a button that exists outside the Mapbox map container, and not display the normal drawing control. A hacky way to do this would be to simply move the button after…
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219