mapbox-gl-js


How to fix 'window.URL.createObjectURL is not a function' when testing mapbox-gl in React?

依然范特西╮ 提交于 2020-01-16 09:02:29
问题 I'm testing React component with Mapbox, material-ui and custom styles. I use Jest + Enzyme for testing. I have problem: 'window.URL.createObjectURL is not a function'. I read similar questions: github.com/uber/react-map-gl/issues/210 github.com/mapbox/mapbox-gl-js/issues/3436 github.com/mapbox/mapbox-gl-js-mock and tried to add something but without success. Please, fix the issue. CodeSandbox 回答1: I had faced exactly same issue with my jest test suite. After some trial and searching, I was

Mapbox: Get loaded tile coordinates? [closed]

☆樱花仙子☆ 提交于 2020-01-14 04:15:09
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I'd like to load 3D terrain onto my mapbox map, like Peter's example, however I'm hoping to find a much simpler implementation. My idea is to use mapbox's data event to get each loaded tile and simply load a three.js mesh above it.. but I need to figure out how to calculate each

How to setup a centralized state for a mapbox map in Vuex?

青春壹個敷衍的年華 提交于 2020-01-13 09:36:06
问题 I just started using vuex with vue. I do (roughly) understand the docs. I have a specific issue for which I am not sure whether I should use vuex and if so how to go about. I have an app in which mapbox map(s) are omnipresent in various layouts and components etc. As I will be making several vue single file components but are working with one same instance of a mapbox map I think it makes sense to have the mapbox map initiated and managed in the vuex store. So e.g. when I change the map

Mapbox Web GL JS - querySourceFeatures() function with vector tile source

强颜欢笑 提交于 2020-01-13 06:31:26
问题 I've got a vector tileset on Mapbox that I created by uploading a geojson file comprising polygons representing particular suburbs in Victoria, Australia. My vector tileset has three properties - suburb, state, postcode - corresponding to the feature properties in the geojson. I can also successfully query those properties via the Mapbox web gl js library to get an accurate map. For example I've got a map working that shows a popup when I click a highlighted polygon, and the popup correctly

Mapbox GL JS: Export map to PNG or PDF?

一曲冷凌霜 提交于 2019-12-31 19:21:36
问题 I'm using Mapbox GL JS version 0.32. Is there a way to export the map to a high-res PNG or PDF? Obviously, I can just screenshot, but it would be nice if there was a more formal way. I found this repo, but it looks old and isn't clear how it works. I tried using the preserveDrawingBuffer option: var map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/light-v9', minZoom: 4, maxZoom: 14, center: [-2.0, 53.3], preserveDrawingBuffer: true }); console.log(map.getCanvas()

Mapbox GL JS: Export map to PNG or PDF?

天涯浪子 提交于 2019-12-31 19:21:34
问题 I'm using Mapbox GL JS version 0.32. Is there a way to export the map to a high-res PNG or PDF? Obviously, I can just screenshot, but it would be nice if there was a more formal way. I found this repo, but it looks old and isn't clear how it works. I tried using the preserveDrawingBuffer option: var map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/light-v9', minZoom: 4, maxZoom: 14, center: [-2.0, 53.3], preserveDrawingBuffer: true }); console.log(map.getCanvas()

Mapbox gl js - draw a car marker

匆匆过客 提交于 2019-12-31 05:11:08
问题 I need to draw a car marker based on it's position. But, unlike all official examples, like this, I want size of my marker to be dependent on zoom level. And, I want it to have heading as well - I need to rotate it based on the car's heading. Is it possible with Mapbox GL JS, and how to do it? 回答1: The Symbol layer https://www.mapbox.com/mapbox-gl-js/style-spec#layers-symbol is best suited for this, see this example https://www.mapbox.com/mapbox-gl-js/example/rotating-controllable-marker/ 来源:

Directions between Two-point location in mapbox-gl - React Native?

限于喜欢 提交于 2019-12-28 07:08:07
问题 I have two point i get it from database and i want to render a line From start point to end point what I got is the Straight line in two points without consideration the routes and directions on the maps So how can i handle it to take a look for routes and Directions on the map? here's what i got here's what i expect here is my code import MapboxGL from '@react-native-mapbox-gl/maps'; import React, {Component} from 'react'; import {PermissionsAndroid, StyleSheet, View} from 'react-native';

Mapbox-GL GEOjsonSource vs Datasource

醉酒当歌 提交于 2019-12-25 17:25:36
问题 confused by the API on mapbox-gl-js. You can add a geojson file by using GEOjsonsource or DataSource, what is the difference ? It seems like you can only associate a style with a Datasource, not a GeoJsonsource ? 回答1: Both of the links in your question ("GEOjsonsource" and "DataSource") describe to the same domain object, GeoJSONSource . The first link is to the Mapbox GL Style Specification, which explains how to declare a GeoJSON source in a style. A style is a JSON file that describes how

Mapbox-GL GEOjsonSource vs Datasource

时光毁灭记忆、已成空白 提交于 2019-12-25 17:23:15
问题 confused by the API on mapbox-gl-js. You can add a geojson file by using GEOjsonsource or DataSource, what is the difference ? It seems like you can only associate a style with a Datasource, not a GeoJsonsource ? 回答1: Both of the links in your question ("GEOjsonsource" and "DataSource") describe to the same domain object, GeoJSONSource . The first link is to the Mapbox GL Style Specification, which explains how to declare a GeoJSON source in a style. A style is a JSON file that describes how

工具导航Map