Questions tagged [mapbox-gl-js]

A WebGL JavaScript interactive maps library that can render Mapbox Vector Tiles.

Mapbox GL JS is a JavaScript maps library developed by Mapbox to render Mapbox Vector Tiles. It allows developers to create web maps with very powerful options for dynamic styling and client-side interactivity. Maps styles can be updated in the browser. Mapbox GL JS is based on the OpenGL API for rendering 2D and 3D vector graphics.

323 questions
13
votes
1 answer

mapbox gl expression to match multiple values

i have a layer that i want to filter by multiple values stored in array let filter = ['in','id', 1,2,3] map.setFilter('layer_name',filter) this works fine and it will return only features with ID 1,2,3 but in Mapbox GL specs, they label this in…
Ibrahim Mohammed
  • 389
  • 1
  • 3
  • 14
7
votes
2 answers

How to get geometry of clicked feature?

From Mapbox's documentation, I should get a GeoJson feature object when I call queryRenderedFeatures method. I run it from a click event without any filter: this.map.on("click", function(e) { var clickedCluster …
Fractaliste
  • 255
  • 1
  • 3
  • 9
4
votes
1 answer

Matching multiple properties in mapbox gl js filter

I am trying to write a filter that will match on values from several properties of a layer. For example, in my hypothetical layer of breweries, I'd like to match those breweries that have a state name of Utah, Texas or Florida and a brewery type of…
jotamon
  • 1,737
  • 2
  • 28
  • 46
3
votes
2 answers

Mapbox GL JS splitting tileset polygons

I am trying to highlight features in a tileset-layer based on this tutorial: https://jsfiddle.net/oyjLzfq4/1/ The grey layer is stored as a tileset in Mapbox studio. The feature under the mouse cursor is transferred to a dynamic layer in the…
tobias47n9e
  • 1,231
  • 2
  • 17
  • 35
2
votes
0 answers

Show multiple Lanes (e.g. both directions) for one OSM way geometry

What's the best-practice way to show multiple lanes for one OSM way in Mapbox GL JS? Let's say we have the following OSM way which is a collection of nodes: Is there an easy way to visualize e.g.: both driving directions at the same time multiple…
hb0
  • 71
  • 8
2
votes
1 answer

Mapbox GL JS - Zoom to linestring feature - fitbounds

I'm slowly trying to switch to geojson layers with Mapbox GL JS. I have few layers on my test map but I can't get the fitbounds to work. What I want to achieve is: Hoover over linestring highlights it - it already works Click on linestring should…
Voyteck
  • 81
  • 1
  • 6
1
vote
1 answer

Detecting mouse move end event in Mapbox GL JS?

I need to detect when mouse over mapbox gl js ends movement in order to make a request to the server only when mouse has stopped the movement but it doesn't exist a "mouseStop" event or anything similar in Mapbox GL JS Api reference Any idea how to…
Toni BCN
  • 327
  • 1
  • 4
  • 17
1
vote
1 answer

Mapbox expression to return greater of two values

I'm looking to plot the equivalent of the SQL query SELECT column_3 FROM my_object WHERE map_layer is not null AND column_1 > column_2; Using this answer I can see where the expression should go (in the filter) and that I can combine multiple…
mapping dom
  • 1,492
  • 1
  • 11
  • 24
1
vote
1 answer

How to enlarge the marker on mouseover in mapbox gl js

i have 3 markers and when i hover on the marker, i want the marker to get enlarged. can anyone help me to solve this. I had tried to change the pointer on mouseover but not getting how to enlarge marker on hover. TS: mapboxgl.accessToken =…
Bhrungarajni
  • 111
  • 1
  • 3
1
vote
2 answers

MapBox GL JS popups for the 0.18.0 version?

I've this sample code using MapBox GL JS in which I load a GeoJSON point layer and I define the popup structure when the user clicks on point to show information details ...
Cesare
  • 2,001
  • 8
  • 36
  • 60
1
vote
1 answer

Mapbox GL - How to populate custom icons using vector source?

When reading examples of Mapbox GL using custom markers, I've seen examples - ie: https://www.mapbox.com/mapbox-gl-js/example/geojson-markers/ where geojson data is hard coded (geometry) and icons can be custom selected for the map... In a quick…
kremzeek
  • 71
  • 1
  • 4
1
vote
1 answer

layer incorporation in Mapbox GL JS

Currently in the process of creating an interactive choropleth map with different coloured regions to indicate rainfall levels. The problem I have is that to do this in mapbox GL JS, you have to create different layers to indicate the different…
Zev
  • 61
  • 1
  • 5
0
votes
1 answer

Using mapbox static image api as a raster layer is distorted

I'm trying to generate a static image of a map for use when the user's device is offline. I request the static image with a bounding box (that is calculated automatically to fit all my features in) and the maximum resolution in the aspect ratio of…
Titan
  • 427
  • 3
  • 6
  • 16
0
votes
1 answer

How do I make it possible to control the camera in Mapbox GL JS like a 16-bit JRPG airship?

This is me controlling the camera in Mapbox GL JS with the arrow keys on the keyboard: https://streamable.com/e/orhkbu?autoplay=1 As you can tell, it doesn't look nor feel very good. Not even any rotating -- only "strafing". Of course, you can use…
0
votes
0 answers

How to animate a line-stroke property in MapBox GL

I'd like to add a style property to a line that invokes flow. For example, a flowing river or a fiber optic line carrying data. Can anyone suggest how to create this sort of effect on a line in MapBox-GL-JS? Maybe this could be accomplished will a…
jotamon
  • 1,737
  • 2
  • 28
  • 46
1
2