Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapbox GL draw lines and bezier

There is some way to draw line inside Mapbox GL? For example, i need to draw some lines (straight or curve) that connect my markers. With Mapbox i can use Arc.js but i don't know if there already exist some solution for Mapbox GL.

I found mapbox-gl-draw (https://bl.ocks.org/danswick/083a0b48c2cc78c4a08d) but it seems just a tool to use inside a map... but i don't see any API to for draw using javascript.

I also found this Tesspathy (http://gree.github.io/tesspathy/) and maybe one solution could be using it to draw inside a map's context.

What do you think? What could be the best way? Thanks!

like image 988
Mauro Avatar asked Jun 29 '16 18:06

Mauro


People also ask

How do you draw a line in Mapbox?

The preferred way to draw lines within Mapbox GL JS is to express the lines as GeoJSON and add them to the map as a GeoJSONSource / line layer pair. You might find this example of drawing a GeoJSON line and this example of drawing a great arc line helpful.

How do I add multiple markers to Mapbox?

To add multiple markers, or to add markers to interactive web or mobile maps, you generally must provide point data in GeoJSON format or in a vector tileset. You can add data to a map style before runtime by using the Mapbox Studio style editor to add a vector tileset as a source for a layer in a map style.

Is Mapbox completely free?

While Mapbox isn't entirely free, it has a generous free tier in its pricing packages that makes the service attractive for apps with a low volume of users. Free for up to 25,000 mobile users and 50,000 web loads.

Is Mapbox GL free?

Is Mapbox GL JS open source? The previous version, Mapbox GL JS v1, is indeed a free and open-source, BSD3 licensed software. Anyone can contribute to it, or start their own derived work based on it, for free. As of February 2021, the v1 source code is still available from the Mapbox Github.

Can Mapbox-GL-draw be used to draw Bezier curves?

mapbox-gl-draw is the Mapbox supported GeoJSON drawing tool for mapbox-gl. It creates GeoJSON which does not support bezier curves, but it can be used to draw LineStrings. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.

How to draw lines in Mapbox GL JS?

Thanks! The preferred way to draw lines within Mapbox GL JS is to express the lines as GeoJSON and add them to the map as a GeoJSONSource / line layer pair. You might find this example of drawing a GeoJSON line and this example of drawing a great arc line helpful. mapbox-gl-draw is the Mapbox supported GeoJSON drawing tool for mapbox-gl.

What are the supported GeoJSON drawing tools for Mapbox-GL?

mapbox-gl-draw is the Mapbox supported GeoJSON drawing tool for mapbox-gl. It creates GeoJSON which does not support bezier curves, but it can be used to draw LineStrings.

What is Mapbox-GL-draw used for?

mapbox-gl-draw is the Mapbox supported GeoJSON drawing tool for mapbox-gl. It creates GeoJSON which does not support bezier curves, but it can be used to draw LineStrings. Thanks for contributing an answer to Stack Overflow!


Video Answer


2 Answers

The preferred way to draw lines within Mapbox GL JS is to express the lines as GeoJSON and add them to the map as a GeoJSONSource / line layer pair.

You might find this example of drawing a GeoJSON line and this example of drawing a great arc line helpful.

like image 154
Lucas Wojciechowski Avatar answered Oct 19 '22 01:10

Lucas Wojciechowski


mapbox-gl-draw is the Mapbox supported GeoJSON drawing tool for mapbox-gl. It creates GeoJSON which does not support bezier curves, but it can be used to draw LineStrings.

like image 25
Matthew Whittemore Avatar answered Oct 19 '22 00:10

Matthew Whittemore