Adding data to a displayed map on mapbox

痞子三分冷 提交于 2019-12-10 11:46:52

问题


I know how to display a map now from this here. But what I want to do is now add data to it, sort of like what this link does here. Eventually I need to call a python function that returns this data that gives coloring to a particular area which looks like this:

[{'type': 'scattermapbox', 
'mode': 'markers', 
'text': ['Census Tract:304.01<br>
Predicted Growth Rank:1.0<br>
    Year: 2017 '], 
'marker': {'size': 1, 'color': ['rgba(247, 251, 255, 255)'], 
'colorscale': [[0.0, 'rgba(8, 48, 107, 255)'], [0.05263157894736842, 'rgba(8, 48, 107, 255)'], [0.10526315789473684, 'rgba(8, 48, 107, 255)'],
               [0.15789473684210525, 'rgba(8, 48, 107, 255)'], [0.21052631578947367, 'rgba(8, 48, 107, 255)'], [0.2631578947368421, 'rgba(8, 48, 107, 255)'],
               [0.3157894736842105, 'rgba(8, 48, 107, 255)'], [0.3684210526315789, 'rgba(8, 48, 107, 255)'], [0.42105263157894735, 'rgba(8, 48, 107, 255)'],
               [0.47368421052631576, 'rgba(8, 48, 107, 255)'], [0.5263157894736842, 'rgba(8, 48, 107, 255)'], [0.5789473684210527, 'rgba(8, 48, 107, 255)'],
               [0.631578947368421, 'rgba(8, 48, 107, 255)'], [0.6842105263157894, 'rgba(8, 48, 107, 255)'], [0.7368421052631579, 'rgba(8, 48, 107, 255)'],
               [0.7894736842105263, 'rgba(8, 48, 107, 255)'], [0.8421052631578947, 'rgba(8, 48, 107, 255)'], [0.894736842105263, 'rgba(8, 48, 107, 255)'],
               [0.9473684210526315, 'rgba(8, 48, 107, 255)'], [1.0, 'rgba(8, 48, 107, 255)']], 
'opacity': 0, 
'cmin': 1.0, 
'cmax': 1.0, 
'showscale': False},
'showlegend': False, 
'lon': [-122.77720976814757],
'lat': [45.47996783203806],
'hoverinfo': 'text'}, 
Scattermapbox({
'lat': [45.48553],
'lon': [-122.77518],
'marker': {'color': 'rgb(231, 41, 74)', 'size': 9},
'mode': 'markers',
'showlegend': False,
'text': [9555 SW DUNCAN LN]
})]

For now I want to figure out how to take the first link I presented and add data from the second link. Any suggestions are greatly appreciated.

来源:https://stackoverflow.com/questions/58495152/adding-data-to-a-displayed-map-on-mapbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!