geojson file doesn't plot points on mapbox in jupyter notebook
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2023 05:20 PM
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()
- Labels:
-
Databricks Cluster
-
GeojsonFile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 12:58 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2023 04:44 PM
@Kaniz Fatma Do you have any updates? were you able to reproduce the error? i am not able to plot within jupyter notebook.

