mapbox

react-map-gl without API key using osm tiles

久未见 提交于 2019-12-06 11:15:38
问题 Is it possible? This tells me it is, but dont know why it defines and API key. but I cannot get it to work with react-map-gl StaticMap class. The property I can see from that class is just mapStyle which would take a standard Mapbox vector tiles path/name. Does it take an object? My code does not give me an error or show the tiles I request. <DeckGL> <StaticMap mapStyle= {{ "version": 7, "sources": { "simple-tiles": { "type": "raster", "tiles":["http://a.tile.openstreetmap.org/{z}/{x}/{y}.png

iOS: Creating dynamic speech balloons for annotations that appear from user input using MapBox

天涯浪子 提交于 2019-12-06 10:17:00
In the code posted, when you click on the annotation, the speech balloon pops up to say Hello World! Welcome to my marker I would like to know how to make the speech bubble appear while using the app, and have the speech bubble display some text that the user would enter in, and disappear after about an hour or so. The bubble would be able to be seen by other users even if the user logged out or closed the app, and the bubble would still be open when the user goes back into the app, unless the window of time for the bubble has passed. Thank-you import Mapbox class ViewController:

How to zoom on marker click event in Mapbox Leaflet?

早过忘川 提交于 2019-12-06 10:08:49
I want to zoom on a marker when it is clicked. I am using Mapbox and leaflet. I tried: marker.on('click', function(e){ map.setView([e.lat, e.lng], 12); }); But it gives me some kind of error: TypeError: t is null I even tried: marker.on('click', function(e){ map.fitBounds(marker.getBounds()); }); To get the latitude and longitude of the event, you must use e.latlng: latlng reference . Use this: marker.on('click', function(e){ map.setView(e.latlng, 13); }); Try marker.on('click', function(e){ map.setView([e.latlng.lat, e.latlng.lng], 12); }); 来源: https://stackoverflow.com/questions/29385063/how

Add custom map style to Mapbox.js

寵の児 提交于 2019-12-06 08:09:02
I just created my personal map style with Mapbox Studio and i'm try to use it with Mapbox.js. (NOT Mapbox Gl js!!) As written in the docu You can load and display styles from the API using Mapbox GL JS or the Mapbox Mobile SDKs or you can request styles directly from the API. This request requires an access token with the styles:read scope. I added on my < head > a link to: https://api.mapbox.com/styles/v1/myusername/mystyleid?access_token=mypublicaccesstoken I can see the JSON response but i still see basic map style. How can i use my custom style in mapbox.js? Sorry, but that won't work.

Double on click event with mapbox gl

妖精的绣舞 提交于 2019-12-06 08:00:52
I am redrawing layers on style.load event and removing the layers map.on('style.load', function() { loadByBounds(tempBounds) }); function loadByBounds(b) { if (map.getLayer("cluster-count")) { map.removeLayer("cluster-count"); } ... map.on('click', 'unclustered-point', function(e) { var popup = new mapboxgl.Popup() .setLngLat(e.features[0].geometry.coordinates) .setHTML(text) .addTo(map); })} But how to remove map.on('click') events? As when I click the point the Popup() displays 2 times. And when I change layer one more time the onclick event fires 3 times and so on. So I think I have to

Mapbox Android SDK crash - “java.lang.Error: Vertex shader fill failed to compile”

谁都会走 提交于 2019-12-06 07:29:10
After upgrading my Android Studio version to 2.1.3, my application crashes every time I launch it. More precisely, it crashes when trying to load my Mapbox View (that was perfectly working before that). I did some research, and it seems to be a known issue, but I couldn't find any workaround to pass through it... I think it MAY be a problem with the Emulator only, but for now I couldn't try on a lot of physical devices, so I'm not sure about that. But anyway, I really need to use the emulator to debug my app. If someone has any information about that it will be really helpful. Thank a lot!

Open a Mapbox map in QGis

纵饮孤独 提交于 2019-12-06 01:38:20
I'm looking for a way to display one of my Mapbox map in QGis (baselayer edited on mapbox.com & data uploaded from tilemill). Did someone here already find a way ? Is there a feature or a plugin to do that ? Thanks for your future answers ! Adrien Yesterday, I found two solutions by myself : 1) the pretty official "TileLayer Plugin" QGis plugin You'll have to write a TSV file (Tab Separated Values) with, at least, the name, the credits and the URL of your Mapbox map. The URL should look like : http://a.tiles.mapbox.com/v3/mapboxId.mapId/{z}/{x}/{y}.png You just have to replace mapboxId and

Missing MapBox CSS using React

非 Y 不嫁゛ 提交于 2019-12-05 19:49:02
I'm trying to work with MapBox using React. I've created the project with create-react-app, added mapbox-gl ("mapbox-gl": "^0.46.0-beta.1"), but I have a problem with css file. It shows me this warning: This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/ I've followed all steps: 1 - Install the npm package: npm install --save mapbox-gl 2 - Include the CSS file in the of your HTML file: <link href='https://api.tiles.mapbox.com

Mapbox-gl typing won't allow accessToken assignment

廉价感情. 提交于 2019-12-05 16:10:14
问题 I'm using the mapbox-gl library with TypeScript, and I've installed its community sourced type definitions with @types/mapbox-gl . When I try to import and set an accessToken to use the library, my TypeScript compiler throws this error: TS2540: Cannot assign to 'accessToken' because it is a constant or a read-only property. So I pulled up the .d.ts file and the variable in question looks extremely assignable (seen here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types

How to convert radius in metres to pixels in mapbox leaflet?

冷暖自知 提交于 2019-12-05 14:57:47
I am working on an application where I am trying to run some algorithms on a map and calculate coords but they are slightly off because I am running the calculations on latitude and longitudes and the final results are getting distorted. Now I am trying to convert all coordinates to EPSG3857 Web Mercator coordinates like so: var crs = L.CRS.EPSG3857; var zoom = terrainAnalysisMap.getZoom(); markerToPoint = crs.latLngToPoint(marker.getLatLng(), zoom); markerOnRadiusToPoint = crs.latLngToPoint(markerOnRadius.getLatLng(), zoom); Now I also have a radius which I will have to convert from metres to