cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

geojson file doesn't plot points on mapbox in jupyter notebook

kll
New Contributor III

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. 

  # 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()

2 REPLIES 2

kll
New Contributor III

Hi @Kaniz Fatmaโ€‹ 

Thanks for the response.

I have all the required libraries installed to render the map. The code that I linked is from the official mapbox docs. see here: https://github.com/mapbox/mapboxgl-jupyter.

It doesn't appear to be an issue with the token because the map is being rendered in the output cell.

The issue seems to be the data points in `points.geojson` do not appear on the map. That layer is missing. It doesn't throw any errors either, at least in the cell output. The only warning I see is:

/databricks/python/lib/python3.9/site-packages/IPython/core/display.py:419: UserWarning:
 
Consider using IPython.display.IFrame instead

I suspect if you attempt to reproduce on your end within jupyter running on databricks compute, you may experience the same issue.

For reference, I am using:

python 3.9
 
mapboxgl 0.10.2

kll
New Contributor III

@Kaniz Fatmaโ€‹  Do you have any updates? were you able to reproduce the error? i am not able to plot within jupyter notebook.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group