mapbox-gl-js

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

Render a FeatureCollection from a GeoJSON file with multiple types in Mapbox-GL-JS

梦想的初衷 提交于 2019-12-25 06:58:24
问题 We are currently loading layers into mapbox GL from geojson data. If our geojson has a feature collection that contains points and polygons, there does not seem to be a way to have mapbox gl show both because of how you need to set the type of layer. Is there a way to have multiple types for a layer? It seems as if it can't handle multiple. map.addLayer({ "id": "route", "type": "line", //THIS SEEMS TO BE THE LIMITATION "source": "route", }); 回答1: You are correct, GL JS cannot handle multiple

Mapbox cluster's data-driven styling

巧了我就是萌 提交于 2019-12-25 03:14:34
问题 When visualizing clusters with Mapbox's GL JS, how can I show clusters as circles which size/colours are proportional to the average of clustered points' property 'Rev', instead of proportional to the point-count property, as my code is doing it now. Is there any way to do this simply, or should I look into other methods? Here's my GeoJson file, followed by the HTML/JS code: { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-53

Mapbox.GL: scroll zoom in and out to specific coordinates on custom mapbox map

时间秒杀一切 提交于 2019-12-24 13:50:31
问题 I have embedded a custom mapbox studio map onto my site and set the minZoom and maxZoom coordinates so it only zooms out to a certain zoom level and zooms in to a certain zoom level. BUT when the user zooms back in, the map goes where the user places their mouse pointer, rightly so, BUT I want it to zoom back to it's starting point, not where the user places their mouse pointer. This is the closest example I found, but I don't want the narrative, I want the user to just scroll on the map:

Mapbox toggle all layers off except one

隐身守侯 提交于 2019-12-24 10:48:21
问题 I am new to Mapbox and javascript. I'm attempting to slightly modify a Mapbox GL code example, found here, which allows for the toggling on/off of multiple layers. I have four layers, and I would like the user to toggle these layers on and off, but when the map initially displays, I only want one layer toggled on. I am able to have three of the layers turned off when the page loads (here is one as an example): map.addSource("gnat-4zdrvs", { type: 'vector', url: 'mapbox://jesselangdon.bbtex1ps

MapBox GL JS marker/icon animation slow performance

青春壹個敷衍的年華 提交于 2019-12-24 10:04:09
问题 I'm using mapbox-gl-js to animate many image from one coordinates to another on the map. It become slow frame rate when I try to add up to 15 image and above. Doing performance profile on chrome give me the hint to method Actor.receive, which cost the most computational time. /** * Util.js */ var linesDataSource = { "type": "FeatureCollection", "features": [{ "type": "Feature", "properties": {}, "geometry": { "type": "LineString", "coordinates": [ [ 151.15684390068054, -33.89568424317427 ], [

Mapbox case expression

廉价感情. 提交于 2019-12-24 04:48:08
问题 i try to style my mapbox layer using case expression: const max_expr = ['max', ['get', 'POLY_COLOUR_CODE_D'], ['get', 'POLY_COLOUR_CODE_BW'], ['get', 'POLY_COLOUR_CODE_A']]; 'paint': { 'fill-color': ['case', ['==', max_expr, 1], 'green', ['==', max_expr, 2], 'yellow', ['==', max_expr, 3], 'red', ['==', max_expr, 4], 'red'] } but i get following weird error: paint.fill-color: Expected an odd number of arguments. Do you have any idea how to fix this? 回答1: You are probably just missing a default

Mapbox GL Popup set content with custom tag

不羁的心 提交于 2019-12-23 10:34:29
问题 im trying to creater a marker with popup on click, so far so good, the problem is when im trying to set the content of the popup to be my custom tag, for example let popup = new mapboxgl.Popup() .setHTML("<custom-tag></custom-tag>") I know about the option of setDOMContent but I didn't manage to get it right... it suppose to work with document.createElement('custom-tag') so if you can help me on how to use it with custom components. thank you for your help! 回答1: I was able to get this to work