mapbox-gl-js

Persistent layers after style change in Mapbox gl js

你。 提交于 2019-12-11 17:56:01
问题 Is it possible to change map style from Streetview to satellite retaining all manually drawn layers (geojson shapes)? e.g. Let's say we have a circle on Streetview map and want to show the same circle in street view mode. After we change map style to satellite we have to add the circle again. Is there any possibility to avoid that? I want to find the possibility do not process something that was processed already again, to exclude listening for style changes and adding layers again. Is any

Mapbox how to set up the menu so that only the “visible” layers are in an “On” state

浪尽此生 提交于 2019-12-11 17:17:45
问题 I have created a menu that allows me to toggle layers on and off. When the map initially displays, I want only two layers to be turned on. I have been able to turn off the layers i want off during the initial display using: map.on('load', function() { map.setLayoutProperty('id', 'visibility', 'none'); }); However, after several attempts, I haven't been able to have the menu display the layers that are off in a toggled "Off" state. You can find the current map here (If you toggle the first two

In a compiled node module, why do I see (private) methods omitted from the compiled version that exist in the source?

拈花ヽ惹草 提交于 2019-12-11 14:40:23
问题 I'm using Mapbox GL JS, and I've found a private method that might be useful in solving a problem. It's _requestRenderFrame in map.js, and looks like this: /** * Request that the given callback be executed during the next render * frame. Schedule a render frame if one is not already scheduled. * @returns An id that can be used to cancel the callback * @private */ _requestRenderFrame(callback: () => void): TaskID { this._update(); return this._renderTaskQueue.add(callback); } If I try to

How can I query the feature that's closest to the geocode result in Mapbox?

纵然是瞬间 提交于 2019-12-11 12:08:49
问题 I'm trying to create a Mapbox map with thousands of points. I want the user to be able to type an address and a div to be filled with information from the closest point to that address. I'm using the mapbox-gl-geocoder control What would be perfect is if I could use something like: geocoder.on('result', function(e) { var features = map.queryRenderedFeatures(e.result.center) }); But queryRenderedFeatures doesn't accept latlong coordinates, it requires viewport coordinates. The next thing I

MapBox and TIFF

我与影子孤独终老i 提交于 2019-12-11 11:53:12
问题 I am trying to show my TIFF file at the MapBox's map. I am starting with this example: https://www.mapbox.com/mapbox-gl-js/example/vector-source/ by replacing map.addSource('terrain-data', { type: 'vector', url: 'mapbox://mapbox.mapbox-terrain-v2' }); with map.addSource('terrain-data', { type: 'vector', url: 'mapbox://xxx.yyy' }); where xxx.yyy is my Map ID from Data section of the account (https://www.mapbox.com/studio/data/) JavaScript initiates needed calls (to some jpg files), but all of

How to get usable canvas from Mapbox GL JS

徘徊边缘 提交于 2019-12-11 08:38:25
问题 I'm using Mapbox GL, and trying to get a snapshot of it, and merge the snapshot with another image overlaid for output. I have a HTMLCanvasElement off screen, and I'm first writing the canvas returned from Map.getCanvas() to it, then writing the second (alpha transparent) canvas over that. The problem is that, though I clearly see elements onscreen in the Map instance, the result only shows the second image/canvas written, and the rest is blank. So I export just the map's canvas, and I see it

Detect software vs hardware webGL render mode

半腔热情 提交于 2019-12-11 06:57:20
问题 I've got an error I'm trying to catch with MapboxGL that doesn't handle when a version of IE switches the webGL render modes from hardware to software. I've been pouring over documentation and console logging pretty much everything I can, but can't find any documented way to find out if webGL is using hardware or software render modes. Any ideas? 回答1: You can check whether or not a browser can run GL JS in a hardware render mode using the mapbox-gl-supported library <script src='mapbox-gl

Unable to hide profile ui (Traffic, Driving, Walking, Cycling)

末鹿安然 提交于 2019-12-11 06:34:29
问题 I do not find options to hide / remove profile ui(Traffic, Driving, Walking, Cycling) from the mapbox direction. Is there any options available? screenshot of profile ui section area. This is the section, I need to hide,Click here to view the profile ui section pic of mapbox directions The code that i have implemented, enableMapboxDirection() { mapboxgl.accessToken = 'pk.eyJ1Ijoid2FsYWEtbWFwIiwiYSI6ImNqN2VuYmluZjBwZ2UzMnBqM20wNnJieWkifQ.2pKH-XbfOZuXzX9pEqGBjw'; var directions = new

SyntaxError: missing ] after element list

六眼飞鱼酱① 提交于 2019-12-11 05:37:31
问题 I have a mapbox-gl.js map with markers within a vue component. At the end of a mapdrag a list is made of all markers in the viewport (with a setTimeout to avoid performance issues with many markers). Everything works as expected but I get a error at the end of a drag/moveend: Uncaught SyntaxError: Unexpected identifier No further details..., the error refers e.g. to VM9336 which contains: [object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement] The

“MapboxGeocoder is not a constructor” when trying to initialize a MapboxGeocoder inside the ts of my component

喜你入骨 提交于 2019-12-11 05:14:12
问题 I want to add the mapbox geocoding feature to my web app but when I try to initialize it the error comes in. I've tried searching almost on every library inside the node_modules/mapbox-gl-geocoder for some constructor or something to see if I'm importing the wrong library but no success, If tried reading in the documentation but nothing either. import { MapboxGeocoder } from "mapbox-gl-geocoder"; . . . this.map.addControl(new MapboxGeocoder({ accessToken: mapboxgl.accessToken })); 回答1: import