0

I am trying to visualize a map in databricks. I am creating a geodataframe and converting it to geojson. It looks like this:

{"type": "FeatureCollection", "features": [{"id": "0", "type": "Feature", "properties": {"count_me": 51273, "district": "71", "fill_color": [254, 217, 118, 160]}, "geometry": {"type": "Polygon", "coordinates": [[[-73.92872204594605, 40.6644955696853], [-73.93160218672786, 40.66323044440062], ...

I am trying to plot this in a Databricks Python notebook but only a basemap appears.

LAND_COVER = [[-74.2654, 40.4964], [-73.7004, 40.4964], [-73.7004, 40.9156], [-74.2654, 40.9156]]
geojson_layer = pdk.Layer(
    "GeoJsonLayer",
    geojson,
    stroked=True, 
    filled=True,
    get_fill_color='properties.fill_color',
    pickable=True)

polygon_layer = pdk.Layer(
    "PolygonLayer",
    LAND_COVER,
    get_polygon='-',
    get_fill_color='[0, 0, 0, 20]',)

view_state = pdk.ViewState(latitude=40.7128, longitude=-74.0060, zoom=11, bearing=0, pitch=0)

r = pdk.Deck(layers=[polygon_layer, geojson_layer], 
             initial_view_state=view_state)
r.to_html()

How do I visualize my data?

I tried the above code and only the basemap appeared.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.