最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

mapbox - MapboxGL in Jupyter Notebook Not Displaying values from GeoJSON - Stack Overflow

programmeradmin2浏览0评论

I’m trying to visualize NYC buildings and an additional number value (float)with MapboxGL in Jupyter Notebook. The goal is to create an interactive map where:

Buildings are displayed via Address and or Lat/Lon Fine Amount is displayed with some overlay (that is my aforementioned number).

However, while the map loads, the fine values do not appear in the visualization—only a blank map with the legend is shown.

Here is a snippet of my geojson:

{'type': 'Feature',   'geometry': {'type': 'Point', 'coordinates': [-73.950237, 40.808079]},   'properties': {'Property Name': 'KM - 225 West 123rd St',    'Address': '225 West 123rd St',    'Fine_2024':
10895.21,    'Fine_2030': 81968.64}},  {'type': 'Feature',   'geometry': {'type': 'Point', 'coordinates': [-73.94466, 40.833161]},  'properties': {'Property Name': 'CFF Consulting - 559 W 156 st',    'Address': '559 W 156 st',    'Fine_2024': 17251.83,    'Fine_2030':
51102.48}}]

For the code I tried the following (all modules etc load fine):

from mapboxgl.viz import CircleViz
from IPython.display import IFrame

geojson_scaled_file = "LL97_scaled_fine_2024.geojson"
html_output_file = "LL97_map.html"


mapbox_access_token = "xx"


viz = CircleViz(
    geojson_scaled_file,
    access_token=mapbox_access_token,
    center=(-74.006, 40.7128),  # NYC coordinates
    zoom=11,
    color_property="Fine_2024_Scaled",
    color_stops=[[10, 'blue'], [250, 'yellow'], [500, 'red']],  # Color scale
    radius=6,
    opacity=0.8
)


viz.create_html(html_output_file)


IFrame(html_output_file, width=900, height=600)
发布评论

评论列表(0)

  1. 暂无评论