mapbox / mapboxgl-jupyter

Use Mapbox GL JS to visualize data in a Python Jupyter notebook
MIT License
665 stars 137 forks source link

mapbox doesn't render points on jupyter notebook running on Databricks. #192

Open keval-ll opened 1 year ago

keval-ll commented 1 year ago

I am running jupyter notebook on a Databricks cluster and attempting to render a map. I tried the example from the documentation to test and it doesn't plot the points.

python 3.9 mapboxgl 0.10.2

 # Load data from sample csv
    data_url = 'https://raw.githubusercontent.com/mapbox/mapboxgl-jupyter/master/examples/data/points.csv'
    df = pd.read_csv(data_url)

    # Must be a public token, starting with `pk`
    token = mapbox_token

    # Create a geojson file export from a Pandas dataframe
    df_to_geojson(df, filename='points.geojson',
                  properties=['Avg Medicare Payments', 'Avg Covered Charges', 'date'],
                  lat='lat', lon='lon', precision=3)

    # Generate data breaks and color stops from colorBrewer
    color_breaks = [0,10,100,1000,10000]
    color_stops = create_color_stops(color_breaks, colors='YlGnBu')

    # Create the viz from the dataframe
    viz = CircleViz('points.geojson',
                    access_token=token,
                    height='400px',
                    color_property = "Avg Medicare Payments",
                    color_stops = color_stops,
                    center = (-95, 40),
                    zoom = 3,
                    below_layer = 'waterway-label'
                  )
    viz.show()
Screenshot 2023-03-31 at 5 10 31 PM
xyluo25 commented 1 year ago

I got the same results