Questions tagged [mapbox-gl]

A client-side map rendered with implementations in native platforms utilizing OpenGL.

Mapbox GL is an open-source framework and API being developed by Mapbox. Mapbox GL differs from Mapbox as it downloads vector map data and renders the map image on the client.

1207 questions
11
votes
3 answers

Convert coordinates to pixels on screen (and back again)

This is what I'm doing: Clicking a marker on the map to open a side panel and center the map on the marker. The side panel takes up 3/4 of the right side of the screen. This is what I need to happen: Center the marker according to the 1/4 of the…
Tomelower
  • 475
  • 3
  • 8
  • 17
11
votes
2 answers

mapbox how can I add a label to a linestring?

I would like to add text to a linestring. Basically the same way the name of a street shows up in google maps. So if I zoom in or move the map around, the text still shows up on the line. Do I need to add some sort of new layer with the same…
okieBubba
  • 391
  • 1
  • 2
  • 12
11
votes
4 answers

MapBox GL JS marker offset

I'm using MapBox GL JS to create a map with a custom marker: var marker = new mapboxgl.Marker(container) .setLngLat([ datacenters[country][city].coordinates.lng, datacenters[country][city].coordinates.lat ]) …
Dani
  • 2,448
  • 8
  • 27
  • 44
11
votes
1 answer

Show and hide features of a layer in Mapbox GL JS

I have found the following code to show and hide layers in Mapbox GL: https://www.mapbox.com/mapbox-gl-js/example/toggle-layers/ This is helpful, however, I only have one .geojson layer (polylines) with all of the necessary data and do not need to…
iskandarblue
  • 7,208
  • 15
  • 60
  • 130
11
votes
3 answers

Mapbox GL using external maps

I want to use Mapbox GL in my Android application. This service is going to be released soon and I have a tricky question about using the renderer. I like the renderer itself, but I really want to use my own maps data in the application (not the…
Stepan Mazokha
  • 459
  • 1
  • 5
  • 22
10
votes
3 answers

Mapbox production error in console. "Uncaught ReferenceError: y is not defined"

I have a full-stack React.js application deployed on Heroku. Everything deployed fine except for Mapbox. In development, everything works nice. As soon as I open my application in Heroku, Mapbox displays a black screen. I have added config vars in…
Abdul
  • 150
  • 1
  • 8
10
votes
4 answers

Is there any idle event for mapbox gl js?

I need some sort of google maps "idle" event for mapbox gl. When every event fired and the map stop zoomin/out drag etc. and every layer has loaded, and the map is idle. I have to use this code map.on("render", function(e) { …
SERG
  • 3,907
  • 8
  • 44
  • 89
10
votes
3 answers

Recommended way to switch tile urls in mapbox-gl-js

Situation We render a raster layer to the map. The layer's source has an initial tile-url. Now we want to change the tile-url of the source and trigger a reload for the new tiles. E.g. we have tiles for different points in time and we want to step…
Scarysize
  • 4,131
  • 25
  • 37
10
votes
8 answers

how can I detect if singleTap was tapped or annotation on mapView of mapbox?

Requirment on iOS for mapBox map. (I am not talking about MKMapView) how can we detect if singleTap was tapped or annotation on mapView? I need that singleTap will be handled only on empty area of map (without pins), and didSelectAnnotation called…
Nasir
  • 1,617
  • 2
  • 19
  • 34
9
votes
1 answer

MapboxGL JS - Display 3d buildings in lower zoom level

I use MapboxGL JS v2 with mapbox://styles/mapbox/streets-v11 style. And I use this code to display 3D buildings on my map: map.addLayer({ 'id': '3d-buildings', 'source': 'composite', 'source-layer': 'building', 'filter': ['==',…
Marc
  • 1,350
  • 2
  • 11
  • 29
9
votes
3 answers

Rendering vector-tiles using Mapbox using react-mapbox-gl

I have a geoJSON file that I convert into vector.tiles using this npm package. I use const tileIndex = geojsonvt(geoJSON). The geoJSON file has the following format and it gets converted without any error. const geoJSON = { type:…
relu
  • 333
  • 1
  • 3
  • 18
9
votes
3 answers

Mapbox with Angular 6. "map container not found" error

I am developing my first angular web app and I want to introduce something similar to Google maps. I dón´t want to use this last one because of new billing politics, so I have tried MapBox. Following the tutorial, I managed to create the map I need;…
user6791921
9
votes
1 answer

Why I am getting blank page for Mapboxgl api on IOS?

Working on mapboxgl with ionic3, angular4 and cordova. I have build .apk and .ipa files. I installed .apk file in my android device it works as expected (ie mapbox tiles, my icons (I have added some icons to custom some functionalities for eg.…
Gnik
  • 7,120
  • 20
  • 79
  • 129
9
votes
9 answers

Mapbox GL JS: Style is not done loading

I have a map wher we can classically switch from one style to another, streets to satellite for example. I want to be informed that the style is loaded to then add a layer. According to the doc, I tried to wait that the style being loaded to add a…
fralbo
  • 2,534
  • 4
  • 41
  • 73
9
votes
3 answers

Q: how to add "fade in" transition effect for Mapbox circle layer

I'm loading points from Geojson in batches and would like to add "fadeIn" effect or animation when the points first appear in Mapbox. this.map.addLayer({ id: 'points', type: 'circle', paint: { 'circle-radius-transition': {duration: 300}, …
zocoi
  • 990
  • 8
  • 11
1
2
3
80 81