mapbox-gl

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

Stackoverflow snippet throws an error but outside it is working

こ雲淡風輕ζ 提交于 2019-12-11 06:17:31
问题 I have created a stackoverflow snippet inside an answer, but get an error if I am using map.queryRenderedFeatures() . Outside the snippet in the index.html all works fine. Could it be a CORS problem ? I got no error message except an undefined return. The strange thing is that sometimes it is working in FullPage Modus Here goes my snippet: mapboxgl.accessToken = 'pk.eyJ1IjoicHJheWVyIiwiYSI6ImI3OGRjZjcyY2JiZTUzODMwZWUxZDdiNjRiMWE4NjI5In0.zETX-x6-XPpAv3zt4MiFwg'; var map = new mapboxgl.Map({

Mapbox GL - my basic, default marker won´t show up on the map

柔情痞子 提交于 2019-12-11 05:12:42
问题 lately, I started fiddling with MapBox and right now, I am trying to add the marker to the map. Not as easy as it seems. I am trying to add basic, default marker with code copypasted straight out of "Mapbox GL" reference guide. Still, it won´t show up. This is the code I use, it cant get simpler that this... var marker = new mapboxgl.Marker().setLngLat([45.702117, 42.395926]).addTo(map); Does anybody have an idea why it doesnt work? Whole "not working scenario" can be seen at http://www

How to use mapbox “case” expresion on nested properties?

天大地大妈咪最大 提交于 2019-12-11 05:08:49
问题 How to use nested value in order to use case == operator? Something like: this.map.setPaintProperty("somelayer", "fill-color", ["case", ["==", ["properties:some_prop"], someval], "#34c0dd", "#499bbc"] where properties is dict: properties = { some_prop: 1, some_prop2: 2, // and so on } I have tried ["properties.some_prop" ] and ["properties"]["some_prop"] and that does not work as well. And how to print that mapbox query like console.log or something? 回答1: If properties is just the regular

Possible to render react component within mapboxgl.Popup() in .setHTML or .setDOMContent?

二次信任 提交于 2019-12-11 04:57:27
问题 I am wondering if it is possible to render a react component within a mapboxgl.Popup(). Something like this: componentDidMount() { new mapboxgl.Popup() .setLngLat(coordinates) .setHTML(`<div>${<MapPopup />}<p>${moreText}</p></div>`) //.setDOMContent(`${<MapPopup />}`) ????? .addTo(this.props.mapboxMap) }) Or should this be done using ReactDOM.render? ReactDOM.render(<MapPopup />, document.getElementById('root')) This project will have buttons and inputs in the popup that connect to a redux

MapBox - Cluster Zooming

夙愿已清 提交于 2019-12-11 03:16:37
问题 Is it possible to recreate the click to zoom on clustering like Craigslist Mapview does with MapBox? When you click, it zooms to the area those location dots are contained in. Here's my clustering code: map.on('load', function() { map.addSource("location", { type: "geojson", data: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/73873/test.geojson", cluster: true, clusterMaxZoom: 14, clusterRadius: 100 }); map.addLayer({ id: "clusters", type: "circle", source: "location", filter: ["has", "point

mapbox-gl: calculate map bounds from center point, zoom level and dimensions

喜欢而已 提交于 2019-12-11 01:39:05
问题 Using mapbox-gl-native in Node.js I need to find out the actual bounds of a map after rendering. I'm rendering a map as outlined in the project's README.md: var fs = require('fs'); var path = require('path'); var mbgl = require('mapbox-gl-native'); var sharp = require('sharp'); var options = { request: function(req, callback) { fs.readFile(path.join(__dirname, 'test', req.url), function(err, data) { callback(err, { data: data }); }); }, ratio: 1 }; var map = new mbgl.Map(options); map.load

Mapbox Icons/Markers “BearingSnap” or Snap to Position

自古美人都是妖i 提交于 2019-12-10 20:42:06
问题 Is there a way to move icons/markers to a certain location where it will then "snap" to the location? For example, chess games on the computer where when you move a chess piece to the correct square, it will snap to that position when you let go of the piece near/around the square. So what I want is to move a marker or an icon to a certain location, let's say the capital of California, and the marker will "snap" to the location that I want when I move it and let go of the marker near the

Vector tile route finding

橙三吉。 提交于 2019-12-10 15:33:11
问题 Has anyone used either Mapbox or OpenMapTiles vector tiles to find routes from one place to another? It seems to me like those tiles are made for display and don't contain intersection information the way that say Open Street Map does. 回答1: Mapbox has directions API which uses Open Street Map: Mapbox’s directions services use a network of roads and paths, or ways, derived from OpenStreetMap, a collaborative project to create a free and editable map of the world. Contributors to OpenStreetMap