[Python] Not seeing Map Elevation with Pydeck

Discussão em 'Python' iniciado por Stack, Novembro 27, 2024.

  1. Stack

    Stack Membro Participativo

    I am using topojson map data.

    Essentially I expect to see elevation of each Zone's height based on the data_count value. But I see all zones in equal height. get_elevation in place of get_elevation_weight shows 2D map. As in the image the count values are different left:659, right:250 but the elevation looks the same

    My code snippet looks like:

    with open(topojson_file) as f:
    topojson_data = json.load(f)

    # Editing TopoJSON with data counts from csv data
    for zone in topojson_data['features']:
    division_name = zone['properties'].get('division', 'Unknown')
    data_count = division_data_counts.get(division_name, 0)
    zone['properties']['data_count'] = data_count

    geojson_layer = pdk.Layer(
    "GeoJsonLayer",
    topojson_data,
    opacity=0.6,
    stroked=False,
    filled=True,
    extruded=True,
    get_fill_color="[data_count * 10, 150, 200]",
    get_elevation_weight="data_count * 100",
    pickable=True,
    auto_highlight=True,
    )

    view_state = pdk.ViewState(
    latitude=data['latitude'].mean(),
    longitude=data['longitude'].mean(),
    zoom=7,
    pitch=60,
    )

    r = pdk.Deck(
    layers=[geojson_layer],
    initial_view_state=view_state,
    tooltip={
    "html": "<b>Zone:</b> {division}<br/><b>Data Count:</b> {data_count}",
    "style": {"color": "white"}
    }
    )`


    data_count is defined elsewhere which I have no problem with. There is no issue with my data: This is loading my data_count directly on pydeck without the topo_json

    Continue reading...

Compartilhe esta Página