mapbox

Leaflet and Mapbox in modal not displaying properly

不想你离开。 提交于 2019-12-11 04:07:11
问题 Having a problem where Mapbox using Leaflet is not displaying correctly in a modal. The map and marker are in the upper left and the rest of the tiles are blank. I have tried the code directly in a page and not a modal and it works... <style> #mapid { height: 300px; } </style> <div id="mapid"></div> <script> var mymap = L.map('mapid').setView([<?= $return['latitude']; ?>, <?= $return['longitude']; ?>], 13); //var mymap = L.Map('mapid', { center: new L.LatLng(<?= $return['latitude']; ?>, <?=

Leaflet z-index

僤鯓⒐⒋嵵緔 提交于 2019-12-11 03:49:37
问题 I'm porting some Google Maps code to Leaflet (well, Mapbox actually). I have quite a lot of shapes (like rectangles, polygons) and markers on the map and I need the ability to adjust their order manually at any time, not just when adding them for the first time. In google maps there was a setZIndex method which allowed to adjust order of elements inside a pane (shapes were always below the markers). How can I do it in Leaflet? If it's not available in the api, what's the best way to implement

Dynamically change MGLPointAnnotation image on Mapbox iOS SDK

前提是你 提交于 2019-12-11 03:28:19
问题 I have an app that uses a map of Mapbox on its iOS SDK and present markers ( MGLPointAnnotation ) on it. I want to change the image of a marker when it selected. MGLPointAnnotation has no image property and I've tried to call the delegate method mapView(mapView, imageForAnnotation annotation) but it didn't work. Any idea how can I do that? Thanks! 回答1: I'm pretty sure that there is no way to change an annotation after is has been added to the map (except it is an annotationView) The mapView

MapBox - Cluster Zooming

夙愿已清 提交于 2019-12-11 03:16:37
问题 Is it possible to recreate the click to zoom on clustering like Craigslist Mapview does with MapBox? When you click, it zooms to the area those location dots are contained in. Here's my clustering code: map.on('load', function() { map.addSource("location", { type: "geojson", data: "https://s3-us-west-2.amazonaws.com/s.cdpn.io/73873/test.geojson", cluster: true, clusterMaxZoom: 14, clusterRadius: 100 }); map.addLayer({ id: "clusters", type: "circle", source: "location", filter: ["has", "point

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-gl: calculate map bounds from center point, zoom level and dimensions

喜欢而已 提交于 2019-12-11 01:39:05
问题 Using mapbox-gl-native in Node.js I need to find out the actual bounds of a map after rendering. I'm rendering a map as outlined in the project's README.md: var fs = require('fs'); var path = require('path'); var mbgl = require('mapbox-gl-native'); var sharp = require('sharp'); var options = { request: function(req, callback) { fs.readFile(path.join(__dirname, 'test', req.url), function(err, data) { callback(err, { data: data }); }); }, ratio: 1 }; var map = new mbgl.Map(options); map.load

Filter out Country with Mapbox

强颜欢笑 提交于 2019-12-11 01:02:32
问题 is there any posibility to show only Germany Country Borders and inner Data with Mapbox ? I dont want the rest of the world displayed. Thankx, Markus 回答1: Yes. Use the Germany GeoJSON from http://code.highcharts.com/mapdata/. Upload it as a dataset, export it to tilesets, and then to a map as a layer. Delete all other layers. 来源: https://stackoverflow.com/questions/40886151/filter-out-country-with-mapbox

How to zoom Mapbox using Swift to a given radius in kilometers?

本秂侑毒 提交于 2019-12-10 22:47:36
问题 I recently updated from legacy Mapbox SDK (version 1.6) to latest Mapbox iOS SDK 3.x. In new version I am not able to figure out how to zoom Mapbox MGLMapView to a given radius in kilometers to fit on screen. In old (version 1.6) RMMapView.zoomWithLatitudeLongitudeBoundsSouthWest method does the job as following: func centerAndZoom(center: CLLocationCoordinate2D, kilometers: Float) { let meters = Double(kilometers * 1000) let region = MKCoordinateRegionMakeWithDistance(center, meters / 2,

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

Mapbox map styling for description box

ⅰ亾dé卋堺 提交于 2019-12-10 19:40:35
问题 I am newbie working on his front end skills and I am designing my own website to learn. I am trying to implement a map using the Mapbox API and I cannot get the styling of the description box I am using in the map. Link to my website The map is at the bottom. Now I have managed to place a hidden description box on the map. When a marker on the map is clicked, the hidden property is removed and when the map is clicked it is added back again. map.css #map { width:100%; height: 500px; } pre