mapbox

Mapbox - Custom marker icons from GeoJson properties

人盡茶涼 提交于 2019-12-24 03:29:53
问题 I'm rendering markers from a an array of GeoJson objects. I'd like to use custom icons for the markers but am not able to determine the correct syntax. Below is a portion of the code I'm using to render the geojson: asGeoJson: -> type: "Feature" properties: title: @get("list_no") price: @get("price") address: @get("address") url: @url() id: @get("id") icon: iconUrl: "/images/map_icon.png" iconSize: [50, 50] iconAnchor: [25,25] popupAnchor: [0, -25] className: "marker" The GeoJson is rendered

How to get current zoom in React-Mapbox-GL?

淺唱寂寞╮ 提交于 2019-12-24 01:13:11
问题 How can i get current zoom of map in react mapbox gl? Package: https://github.com/alex3165/react-mapbox-gl/tree/0df46b1dcf194cdf140638f653221d8a82f0b195 I have tried on example from "How to start" to use getZoom method on Map but it's not working. I have error that Map.getZoom is not a function. EDIT ================ When i try to access it by refs then i have problem like on screenshot. How to get this .state.map.e which have my getZoom function? 回答1: The Map you are using is a ReactMapboxGl

Web地图呈现原理

依然范特西╮ 提交于 2019-12-23 15:54:47
【推荐】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,

Leaflet / Mapbox rendering issue (grey area)

一世执手 提交于 2019-12-23 15:37:46
问题 For some reason, my map has a big grey area on it, until I move it which makes it appear. But on the first look, there's a part missing. I've seen this quite a lot around the web before but never wondered about how to fix it until now. This is a simple Mapbox map using MarkerClusterGroup for clusters. Here's a screenshot and the link to the page: http://vinpin.com/map So I was wondering, is there any easy known fix for that kind of behavior? I can add code snippets if required. Thanks and

Leaflet: How to toggle ALL layers either off or on at once?

我与影子孤独终老i 提交于 2019-12-23 13:19:46
问题 Currently, I have my control set so users can toggle each layer they want to view. But, I am unsure how to build a "all layers off" and a "all layers on" function into my UI. I have over 70+ layers and it can get messy, hence why the need for a "master" on and off switch. Demo fiddle here I have a single geojson object that I am filtering to display markers on my map like so: var myData = [{...}]; var airport = L.geoJson(myData, { filter: function(feature) { switch (feature.properties

Mapbox GL Popup set content with custom tag

不羁的心 提交于 2019-12-23 10:34:29
问题 im trying to creater a marker with popup on click, so far so good, the problem is when im trying to set the content of the popup to be my custom tag, for example let popup = new mapboxgl.Popup() .setHTML("<custom-tag></custom-tag>") I know about the option of setDOMContent but I didn't manage to get it right... it suppose to work with document.createElement('custom-tag') so if you can help me on how to use it with custom components. thank you for your help! 回答1: I was able to get this to work

How do you convert normal geographic json coming from server into geoJson?

早过忘川 提交于 2019-12-23 06:00:46
问题 I have a server with geographic data in normal json format, which I need to change into geojson format so Mapbox can read it. How do you do this? For example, how do you convert this: [ { "id": 0, "name": "Hotel", "icon": "Sleep", "address": "SampleStreet 34", "latitude": 12, "longitude": 55 } ] into this: { "type": "FeatureCollection", "features": [ { "id": 0, "type": "Feature", "properties": { "placeID": 0, "name": "Hotel", "icon": "sleep", "addressFormatted": "SampleStreet 34" }, "geometry

bluebar stays forever even if stopupdating is called in iOS 11

爷,独闯天下 提交于 2019-12-23 03:54:10
问题 I am accessing location services as 'always', i know all the changes made by apple in iOS 11. i updated my plist as required( added new key). I calling stopUpdatingLocation as soon as application goes to the background, but this blue still stays there saying your application is using location in the background. Top of that filled location icon in status bar changes to outlined location icon also. I am using Mapbox SDK as well. Is it a bug with iOS 11 or am i missing something? Just to give

Mapbox GL JS refresh layer

南楼画角 提交于 2019-12-23 03:19:14
问题 I'm using Chroma.js to style a Mapbox choropleth map. I do this by storing in a variable dataStyleProp a single property of the source -- in this case the data are population and the properties are "free", "slave", "white", and "total"). Then I use dataStyleProp to build the Chroma.js color scale. What I would like to do is: Select the value for dataStyleProp from a radio button on the HTML page, Pass that value to the Chroma script, Then refresh the map to show the new choropleth. I've

Mapbox iOS8 Swift mapView.showUsersLocation

a 夏天 提交于 2019-12-23 03:13:31
问题 Im trying using Mapbox iOS8 Swift cocoa plugin for mapbox and facing an issue when trying to show the users location on a mapView. My code is the following func mapView(mapView: MGLMapView!, symbolNameForAnnotation annotation: MGLAnnotation!) -> String! { return "secondary_marker" } let manager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() let mapView = MGLMapView(frame: view.bounds, accessToken: "pk.privateMapboxAccessTokenGoesHere") mapView.autoresizingMask =