mapbox

GeoJson/Mapbox markers: let users change their attributes (e.g. color) via a button [EDITED]

余生长醉 提交于 2019-12-24 19:31:34
问题 (EDIT:I received some thumbs down because accidentally posted the question with an unfinished name, please don't be deterred) As in the example of https://www.mapbox.com/mapbox.js/example/v1.0.0/change-marker-color-click/ I'm trying to let the user change attributes (in this example the color) of markers. In this example of Mapbox the attribute of a marker is changed when the user clicks on the marker. However, I would like to change the attribute of markers when the user clicks on one of the

Web地图呈现原理

为君一笑 提交于 2019-12-24 16:12:32
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 以下内容转载自木的树的文章《Web地图呈现原理》 作者: 木的树 链接: https://www.cnblogs.com/dojo-lzz/p/9250637.html 来源:博客园 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 本篇内容为大家揭开地图呈现原理,大家可通过 腾讯位置服务 官网了解地图并体验! 地图投影 对于接触互联网地图的同学来说,最开始接触的恐怕就是坐标转换的过程了。由于地球是个近似椭球的形状,有各种各样的椭球模型来模拟地球,最著名的也就是GPS系统使用的WGS84椭球了。但是这些椭球体的坐标使用的是经纬度,单位是角度。目前我们的地图大多是二维平面上展示,使用角度为基础来计算多有不便,所以有众多数学家提出各种不同的转换方式来将经纬度表示的位置转换成平面坐标,这个转换过程地图学上成为投影。投影的方式多种多样,对我们做互联网地图的来说,最重要的就是墨卡托投影的变体——Web墨卡托投影。我们先来看一下墨卡托投影的转换过程 (以赤道本初子午线为原点) 投影完毕后的结果就是: 先不要头疼数学公式,已经有很多类库做好了代码实现,比如leaflet: L.Projection.Mercator = { R: 6378137, R_MINOR: 6356752.314245179,

Load GeoJSON into layer from a URL?

纵饮孤独 提交于 2019-12-24 13:15:40
问题 I'm using Mapbox 2.1 and I'm trying to build a chloropleth map from a GeoJSON source, working from this example: https://www.mapbox.com/mapbox.js/example/v1.0.0/choropleth/ However, I've fallen at the first hurdle, because my GeoJSON source is a pure GeoJSON file, not a JS file like their example. So this line doesn't work for me: var statesLayer = L.geoJson(statesData, { style: getStyle, onEachFeature: onEachFeature }).addTo(map); Their JS file defines statesData as a variable: var

MapBox zoom level not honored

僤鯓⒐⒋嵵緔 提交于 2019-12-24 12:34:27
问题 I've built a control using the RMMapView. I've also downloaded a map from MapBox to be offline available, and set the minimum and maximum zoom levels accordingly, like this: RMMapboxSource * tileSource = [[RMMapboxSource alloc] initWithMapID:DEBUG_MAP_ID]; RMMapView *mapView = [[RMMapView alloc] initWithFrame:self.view.bounds andTilesource:tileSource]; mapView.minZoom = [[[tileSource infoDictionary]objectForKey:@"minzoom"] intValue]; mapView.maxZoom = [[[tileSource infoDictionary]objectForKey

Mapbox title on markers always visible

牧云@^-^@ 提交于 2019-12-24 12:01:56
问题 In mapbox, how can I show titles on markers? I want them to be always visible not on mousover or mouse click. 回答1: Use popup.addTo(map) instead of popup.openOn(map) . Also, you might want to address closeOnClick and closeButton . var popup = L.popup({closeButton : false, closeOnClick : false}) .setLatLng([tweet.y, tweet.x]) // Or something .setContent(html) .addTo(map); 回答2: You can open marker popups programmatically using the openPopup method. Here's how you can do this with a bit of

Mapbox annotation layer rotation resets on map zoom or move

喜欢而已 提交于 2019-12-24 11:36:59
问题 I'm trying to customize the appearance of the layers of my annotations in mapbox. I want to rotate every annotation layer. - (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation { if (annotation.isUserLocationAnnotation) return nil; RMMarker *marker; CGPoint xy = CGPointFromString(annotation.userInfo); marker = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"arrow.png"]]; marker.transform = CATransform3DMakeRotation(atan2f(xy.x, xy.y) * 180 / M_PI,0

Icon url in mapbox

让人想犯罪 __ 提交于 2019-12-24 11:35:32
问题 How to add a custom icon in mapbox? var map = L.mapbox.map('map', 'mapbox.streets').setView([0, 0], 1); var geojson = { type: 'LineString', coordinates: value}; var start = value[0]; var end = value[value.length-1]; geojson.coordinates.push((start,end).slice()); // Add this generated geojson object to the map. L.geoJson(geojson).addTo(map); // Create a marker and add it to the map. var marker = L.marker(end, { icon: L.mapbox.marker.icon({ "iconUrl": "https://www.mapbox.com/mapbox.js/assets

How can I add one big image as an overlay in Mapbox?

試著忘記壹切 提交于 2019-12-24 11:31:50
问题 I would like to add a tile source which is basically 1 PNG with a size of 800x800. I created a subclass of RMAbstractWebMapSource implementing the methods below but it doesn't work and I get a log error 'The tile source ... has a different tile side length than the tilesource container'. @implementation CustomTileSource - (NSURL *)URLForTile:(RMTile)tile { return [[NSURL alloc] initWithString:@"THE_URL_OF_MY_PNG"]; } - (NSString *)uniqueTilecacheKey { return @"NLSMap"; } - (NSString *

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 iOS move attribution Button

南笙酒味 提交于 2019-12-24 07:47:26
问题 I'm using the mapbox SDK and I need to show their logo watermark and their attribution mark. I can move them though, so I want to move the attribution button from the bottom right to bottom left next to the logo watermark. I tried the following code but it did not work: func mapViewWillStartLoadingMap(_ mapView: MGLMapView) { mapView.attributionButton.frame.offsetBy(dx: -200.0, dy: 0) } This is how it looks like: 回答1: mapView.attributionButton.contentHorizontalAlignment = .left mapView