mapbox-gl

Multiple markers - Same coordinates

China☆狼群 提交于 2021-02-06 12:56:10
问题 I'm having some troubles trying to display 2 different markers placed at exactly the same coordinates. The case is: we are displaying stores, and some of them are placed at the same building (ie. a mall), so, they are different stores but shares the same ubication/coordinates. Our json source content looks like this: { "properties" : { "id" : "1", "name" : "Store 1" }, "geometry" : { "coordinates" : [-70.66667, -33.45], "type" : "Point" } }, { "properties" : { "id" : "2", "name" : "Store 2" }

Multiple markers - Same coordinates

本秂侑毒 提交于 2021-02-06 12:55:03
问题 I'm having some troubles trying to display 2 different markers placed at exactly the same coordinates. The case is: we are displaying stores, and some of them are placed at the same building (ie. a mall), so, they are different stores but shares the same ubication/coordinates. Our json source content looks like this: { "properties" : { "id" : "1", "name" : "Store 1" }, "geometry" : { "coordinates" : [-70.66667, -33.45], "type" : "Point" } }, { "properties" : { "id" : "2", "name" : "Store 2" }

How to add tile layer to map using mapboxgl.js

倖福魔咒の 提交于 2021-01-29 06:38:19
问题 Here m adding tile created using tiff mapboxgl.accessToken ='pk.eyJ1IjoiZ2F1cmF2Y2F0c3RlY2giLCJhIjoiY2l1cGo0MTl4MDAxajJ1bng5a2xieTY0diJ9.0fDXNulI91U85ngSc4jGCg'; var map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/light-v9', zoom: 13, center: [-122.447303, 37.753574] }); map.on('load', function () { map.addSource('terrain-data', { type: 'raster', url:'mapbox://gaurav.2on6cgzq' }); map.addLayer({ "id": "terrain-data", "type": "line", "source": "terrain-data", "source

Mapbox-gl.js map is undefined in angular-cli project on load event

青春壹個敷衍的年華 提交于 2021-01-28 06:52:43
问题 Started an angular-cli project and installed mapbox-gl via npm. Included the mapbox-gl script and styles in the angular-cli.json file. I can get the map to show, but I cannot add a layer on the load event. The map is undefined suddenly? Here is the template html (app.component.html): <div id="map" style="margin:0; padding:0; position:absolute; top:25px; bottom:0; width:100%;"> </div> And here is my component code (app.component.ts): import { Component, ViewChild, AfterViewInit, OnInit } from

How to fix canvas size in Mapbox GL?

半城伤御伤魂 提交于 2020-12-30 06:29:06
问题 I'm using Mapbox GL to show a map and crop a fixed size image from the center of it. It works great for a particular resolution I designed it (1920x1080) but when I started to make the page responsive where the map styles width and height changes, the canvas size also started to change! So, when I crop the image the size should be always different because 300px on a 900px canvas it's not the same map area as 300px on a 2000px canvas. The canvas size even changes drastically if I change the

Getting uneven click-detection on 3d-objects on mapbox with raycaster

瘦欲@ 提交于 2020-05-17 06:05:41
问题 I am using raycaster in mapbox with 3d-objects. I need to detect the click on the 3d-object.But When I click on the object I get a empty raycaster.intersectObject (array) sometimes and filled array sometimes, rather it should always have the 3d object that I have clicked. I have a simple map as explained here. I have only added the raycasting part to it to keep it as simple as possible. Here is my code. var longitude, latitude, diff, map, destLongitude, destLatitude, distFrmlast = 0; var