We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [mapbox-gl-js]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
497 views

MapboxGL Mapbox streets v7 street layer name

See this example: https://www.mapbox.com/mapbox-gl-js/example/color-switcher/ It styles the water layer and building layer with different colors. I was wondering is there a layer for the "streets" ...
1
vote
1answer
429 views

Offset a label inside a polygon with mapbox-gl style?

Im trying to offset labels on the border of a polygon to the inside of the polygon in a mapbox-gl style. My data has a series of polygons with shared borders, and the labels on the borders need to be ...
0
votes
1answer
465 views

Not all tiles loading in view (web) with Mapbox?

For some reason, my map does not load all the tiles when viewed on the web. Here is a link to the test data - http://bestersurveys.co.za/htmlsite/maptest.html I have nothing funny in my code and ...
1
vote
1answer
725 views

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 ...
2
votes
1answer
2k views

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 ...
1
vote
0answers
155 views

How to get search value of leaflet map

enter code here L.control.scale({ position: 'bottomleft' }).addTo(leafletMap); var searchcontroloption={position: 'topleft'}; L.Control.geocoder(searchcontroloption) .on('markgeocode', function(e) {...
2
votes
1answer
1k views

GeoJSON in MapBox GL JS: Can I set layout and paint properties individually for each feature?

For example I have some GeoJSON here that represents airspace regions and they have in their properties "HIGHALT" in feet, so it would be very natural for me to map this to the fill-extrusion-height ...
1
vote
1answer
2k views

How to get coordinates of all polygon drawn on mapbox

I am new to GIS world and looking to get coordinates of the polygon drawn on mapbox map , so that i can pass the coordinates to my python program. In below program I am trying to capture all co-...
1
vote
0answers
320 views

How do I convert my png tiles to mapbox’ pbf files?

I am trying to use my self hosted maps in Mapbox GL, but I only get errors or black screens. My JS code is: var map = new mapboxgl.Map({ container: 'map', style: { ...
1
vote
1answer
598 views

Mapbox Supercluster on the server side, how?

My tile server pipeline is like this: GeoJSON -> MBTiles -> PBF. The tools that I used are tippercanoe and mbutil. I'm not quite familiar with the vt-pbf, geojson-vt tools. Could anybody help ...
3
votes
1answer
545 views

What is difference between grid layer and feature Layer in mapbox map?

I have created polygon using two way but i have not understand difference between them. using grid layer http://bl.ocks.org/rclark/7043524 using feature layer...... L.mapbox.accessToken = 'pk....
1
vote
0answers
96 views

Keeping properties secure within mapbox-gl

Simply put, how could one develop a mapbox-gl application where the properties are secured ? For example, take a look at this simple mapbox-gl map with properties: http://jsbin.com/hovawa/edit?...
1
vote
0answers
164 views

Can we manipulate geojson data while display the polygon on map? [closed]

This is my geojson: enter code here "features": [ { "geometry": { "coordinates": [ [ [ 74.276821428571402, 20.089249999999982 ...
1
vote
1answer
433 views

Routing with Mapbox Directions

I´ve built my own mapstyle and mapsource on Mapbox. After that I included the Directions Plugin in my HTML-Site. Works so far. Problem is the Directions Plugin don´t use my own Line-Elements for the ...
1
vote
0answers
158 views

Leaflet: Show/Hide Symbols Loaded from a Style File

I have a project that uses an OSM2VectorTiles map with Leaflet through the library, mapbox-gl-leaflet, in order to load my own locally-hosted style file. I edited the style file in Mapbox Studio to ...
1
vote
0answers
459 views

How to create hover effect on each polygon in mapbox map

function createPixelBox(jsonData){ // a1=(x1,y2),a2=(x2,y2),a3=(x2,y1),a4=(x1,y1) var x,y,x1,x2,y1,y2; var geodata=[]; var Length=jsonData.length; for(var i=0;i<Length;...
1
vote
1answer
939 views

Getting Mapbox GL addlayer 'in' filter to work when match target is comma separated list?

How do I get Mapbox GL addlayer 'in' filter to work when the match target is a comma separated list? i.e. v10 will work v7 doesn't var layers = [ ["v1", '#723122', "1,2,3,4,5,6,7,8,9"], ...
3
votes
1answer
2k views

Is there a Mapbox GL renderer that outputs SVG?

I have a vector tile source and a Mapbox GL style sheet and would like to produce vector images (SVG) with them. The renderers I found only render in canvas client-side or PNGs server-side. Any ideas?...
1
vote
1answer
946 views

MapBox GL API: Add 'property' to 'source' to update map feature colors with dynamic data

SUMMARY: I need to color code lines based on information not attached to the dataset in the style. How do I do this? Below is a suggested path, but apparently it may be the wrong direction to solve ...
0
votes
2answers
2k views

MapBox GL JS Draw plugin: how to modify point dimensions?

I need to modify the point dimensions in an application that use MapBox GL JS Draw plug-in (rif. https://github.com/mapbox/mapbox-gl-draw/). I've tried to produce a little example with this code: &...
1
vote
1answer
828 views

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 ...
3
votes
0answers
375 views

Maintaining Curves in Mapbox-GL

I am trying out Mapbox-gl-js as an alternative to our current openLayers 3 solution. This is primarily due to a desire to shift away from raster backgrounds and to utilize the webGL and vector tile ...
0
votes
1answer
2k views

MapBox GL JS + mapbox-gl-draw plugin: Uncaught TypeError: Cannot read property 'style' of undefined

I'm using MapBox GL JS and the mapbox-gl-draw plugin. I need to show a little buffer around my clicked points during my edit session. All seems working fine but I obtain a "Uncaught TypeError: ...
1
vote
1answer
3k views

How to emulate a click on a MapBox GL JS map?

I need to emulate a user click on my MapBox GL JS map. I doesn't matter where in my map: could be useful to do in the point at the center of my maps if this could be easier. UPDATE I've found here ...
3
votes
0answers
964 views

rotate custom icon on mapbox gl js

I try to rotate a custom Marker icon inside Mapbox gl-js. All the commented attempts not working. Are we absolutely need to go with geojson sources to rotate an icon and a custom one that is not able ...
4
votes
4answers
8k views

How to test if a layer exist in a MapBox GL JS map?

I load a GeoJSON layer in a MapBox GL JS map in this way .... map.addSource("route", { "type": "geojson", "data": { "type": "Feature", "properties": {}, ...
0
votes
2answers
8k views

How to load a GeoJSON (in a javascript variable … ) in MapBox GL JS?

I need to load in MapBox GL JS a layer based on a GeoJSON and I started form this example https://www.mapbox.com/mapbox-gl-js/example/geojson-line/ I've my data in a Javascript variable var ...
0
votes
1answer
3k views

Toggling multiple layers with one click? Mapbox GL JS

How would I go about grouping the two layers in the sample code below so they could be toggled on and off together with one button? <html> <head> <meta charset='utf-8' /> &...
0
votes
1answer
280 views

Mapbox GL JS embed image in toggle menu

I would like to embed images inside of the toggle controls so that the user can use the toggle menu as a legend, how do I go about this using Mapbox GL JS? <!DOCTYPE html> <html> <...
0
votes
1answer
782 views

Mapbox GL JS default state of toggle layers

How do I change the default state (off or on) of a toggle menu in Mapbox GL JS? The code that I'm using came from another question on this site Mapbox GLJS - group layers <!DOCTYPE html> <...
2
votes
1answer
250 views

Spatial Query tool for Mapbox

I’ve using Mapbox Studio to create a web map that’ll allow a user to interact with some basic parcel data. I’m looking to add a basic spatial query tool for the user so that they can apply spatial ...
0
votes
2answers
771 views

Rotate Mapbox GL JS map after flyTo transition

I can't seem to have much luck chaining a rotateTo transition after a flyTo transition, here are 2 examples the first one chains another flyTo transition after the 'moveend' event is fired, this works ...
2
votes
1answer
1k views

Get coordinates from drawn items with Mapbox-gl-draw

I'm using mapbox-gl-draw in my application and I need to get and save the coordinates of the drawn items on the map. I've checked and I found turf getCoor method, but I don't know how to access the ...
1
vote
1answer
365 views

Label orientation in Mapbox Studio or Mapbox GL JS

Is it possible to make a label orientation a function of the shape of the polygon it is labeling? I imagine it's possible with Mapbox GL JS with https://www.mapbox.com/mapbox-gl-style-spec/#layout-...
1
vote
0answers
656 views

Mabox GL JS - Display Zoom

How can i display the current zoom level using mapbox ? Like this: https://www.nps.gov/npmap/tools/npmap.js/examples/zoomdisplay-control/ I thought it could be easy, like adding navigation control, ...
4
votes
2answers
2k views

Mapbox GLJS - group layers

I'm trying to build an interactive map, without any knowledge in javascript, and i found myself a bit lost in this large world. I've already designed my style in mapbox studio. And now, trying to ...
0
votes
1answer
571 views

Data-Driven Styling (Mapbox GL JS) for Choropleth Maps - Using Multiple Fields

I have been diving into the Mapbox GL JS library lately and am super impressed and excited by the possibilities and capabilities. Currently I am looking for a solution to building choropleth maps, ...
3
votes
1answer
3k views

Using mapbox gl js offline?

Im just wanting to understand my options for producing an offline map using Mapbox gl js. I have investigated several option with little signs of progress. First, I have tried using Studio by ...
3
votes
0answers
460 views

Data-driven styling in Mapbox GL JS - Error when drawing circle radius by zoom level and property

I'm playing around with data-driven styling in Mapbox GL JS. Setting the circle color based on a layer property works just fine: "circle-color": { 'property': 'mag', 'stops': [ [4, ...
3
votes
1answer
341 views

Storing a Mapbox-hosted vector tileset in a variable (Mapbox-GL-JS)

I'm trying to make a map using Mapbox GL that is basically identical to this example: https://www.mapbox.com/mapbox-gl-js/example/filter-markers/. The main difference that source I'm using is a ...
7
votes
2answers
7k views

Mapbox GL: Possible to move navigation controls?

Would anyone know if it is possible to move the navigation controls from top-right to top-left? By default, it is top-right, but I would like to add a company's logo at that position and I've seen ...
1
vote
1answer
89 views

Publishing Mapbox styles using V2.1 and above

I am trying to integrate mapbox maps/styles in HTML code. I succeeded in doing so using: <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.14.1/mapbox-gl.js'></script> <link ...
6
votes
1answer
4k views

highlight feature with click in mapbox gl

I have a geojson layer of streets that are highlighted when moused-over. My objective is now to highlight individual streets red with a click event. Only one street should be able to be ...
0
votes
1answer
219 views

Override Mapbox Studio minzoom

I've styled some census tract tilesets and set filters in Mapbox Studio, where everything looks fantastic, but I want the tracts to appear shaded irrespective of the zoom level, and Studio won't let ...
1
vote
0answers
1k views

Highlighting polyline features in mapbox-gl.js

I am trying to use the following code to highlight features under the mouse pointer. The difference between my geojson data and the geojson data used in the linked example is that the example is ...
1
vote
1answer
290 views

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 ...
5
votes
2answers
3k views

Adding geojson to Mapbox GL JS

Seem to be having problems adding a geojson featurecollection to Mapbox GL JS. What is the most efficient way to accomplish this? I've looked through the examples given on their site but they involve ...
3
votes
1answer
3k views

Extract geojson 'properties' dynamically with mapbox gl

I have an interactive map based on MapBox WebGL. I have an 'on click' function which is returning all information on data layers at that location (lovely). For each object I am trying to pull out ...
2
votes
0answers
284 views

How to search vector layer features in Mapbox GL JS

I need to add a search bar that will search vector layer attribute features which are hosted by mapbox. I'm using the Mapbox GL JS API. I know this can be done fairly easily with Mapbox js/Leaflet. I'...
1
vote
1answer
1k views

Mapbox GL JS Geocoder marker

I'm still a js noob. I am currently developing a map using the Mapbox GL JS API with their geocoding plugin, however, I'm am not seeing any examples of adding a marker after the return. I did find ...