mapbox-gl-js

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

How to give different colors to marker circle in mapbox gl js

左心房为你撑大大i 提交于 2019-12-11 03:34:49
问题 I have 3 places with marker, i need to give different colors for all 3 markers, can anyone help me.I had tried giving colors inside object as well but nothing worked.I need 3 random colors for all the 3 coordinate points given. I also want to loop the component in an array and should be called to html bu using *ngFor. Component: import mapboxgl from 'mapbox-gl'; mapboxgl.accessToken = 'pk.eyJ1IjoicmFrc2hpdGhhMTkiLCJhIjoiY2pjcHl1YW5wMjR5czJ6bzdqdjZrbDRzeSJ9.OOqu6zVyNsXavzCsYoBdPA'; var map =

MapBox get div element of Marker

核能气质少年 提交于 2019-12-11 01:49:57
问题 I am initially pushing MapBox Marker objects to an array via: var el = document.createElement('div' + index); el.className = 'marker'; deviceMarkers.push(new mapboxgl.Marker(el, { offset: [-50 / 2, -50 / 2] }).setLngLat([device.lat, device.lon]).addTo(map)); Elsewhere in the code, I extract the marker via: var deviceMarker = deviceMarkers[index]; I would like to be able to get 'el' from deviceMarker object, in order to alter the icon size, orientation etc. dynamically. How can I extract 'el'

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

Retrieve data from mapbox geocoder

谁说胖子不能爱 提交于 2019-12-10 11:26:23
问题 i only need the mapbox geocoding autocomplete without the map (to put the result with lat/lng in another request) I managed to put it totally alone without the map using this : <template> <div id='geocoder' class='geocoder'></div> </template> <script> import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder' require('../../node_modules/@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css') mapboxgl.accessToken = '<your access token here>'; var geocoder = new MapboxGeocoder({ accessToken:

Mapbox GL 3D single building highlight selection

纵然是瞬间 提交于 2019-12-10 11:05:35
问题 How can I highlight one single 3D building when hover over it? Something like the OSM buildings highlight feature. It seems the mapbox streets v7 building layer feature properties are so few, it only includes: extrude height min_height type underground There is no unique property to differentiate the building. Is there a way to include the address of the building or some unique ID? 回答1: I do not think there is a unique per-building id in the Mapbox Streets v7 tileset. You may need to build

OSM changes not getting to MapBox?

拈花ヽ惹草 提交于 2019-12-10 10:16:03
问题 I can't be the only one to have noticed this, can I? For about a month now, changes made in OSM have not been appearing on Mapbox maps. For example, changeset http://www.openstreetmap.org/changeset/45041984 (23 days ago) has not appeared on any mapbox style, v6 to v9. Another good example is changeset http://www.openstreetmap.org/changeset/45457434 where I added/edited a few businesses. Only 8 days ago, but easier to see because there are icons. I'm not imagining things, there's something

mapbox gl change icon color

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 01:23:31
问题 Is there a way to change a mapbox-gl-js icon-image color? This code taken from https://www.mapbox.com/mapbox-gl-js/example/geojson-markers/ won't change the marker color to red map.addLayer({ "id": "markers", "type": "symbol", "source": "markers", "layout": { "icon-image": "{marker-symbol}-15", "text-field": "{title}", "text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"], "text-offset": [0, 0.6], "text-anchor": "top" }, "paint": { "text-size": 12, "icon-color" : "#ff0000" } }); I've

Mapbox GL js available icons

爷,独闯天下 提交于 2019-12-09 09:41:23
问题 I am rewriting a web application from Mapbox.js to Mapbox GL js. Using the standard 'mapbox://styles/mapbox/streets-v8' style, where can I find a list of all working marker icons? Here is my code: m.map.addSource("markers", { "type": "geojson", "data": { "type": "FeatureCollection", "features": { "type": "Feature", "geometry": { "type": "Point", "coordinates": ["-75.532965", "35.248018"] }, "properties": { "title": "Start", "marker-symbol": "entrance", "marker-size": "small", "marker-color":