1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] geopandas map centering with countries

Discussão em 'Python' iniciado por Stack, Setembro 12, 2024.

  1. Stack

    Stack Membro Participativo

    I am plotting data for ex-USSR on geopandas and it really does not look nice.

    [​IMG]

    I tried this code published early on 1, 2, but adds no help hence I don't need just map, I need to put data on it. And because I'm merging the 'world' (actually consisting only of ex-USSR countries) and coronavirus data "on 'Country'", then I need that dataframe with original country and adjusted polygons.

    Key pieces of my code:

    url = "https://opendata.arcgis.com/datasets/a21fdb46d23e4ef896f31475217cbb08_1.geojson"
    world = gpd.read_file(url)
    ex_ussr = ['Ukraine', 'Belarus', 'Kyrgyzstan', 'Azerbaijan', 'Tajikistan', 'Armenia', 'Georgia', 'Russia', 'Kazakhstan', 'Lithuania', 'Latvia', 'Estonia', 'Uzbekistan']
    world = world[world['CNTRY_NAME'].isin(ex_ussr)]
    df_world = pd.merge(df_covid, world, on='Country')
    crs = {'init': 'epsg:4326'}
    corona_gpd = gpd.GeoDataFrame(df_world, crs=crs, geometry='geometry')
    f, ax = plt.subplots(1, 1, figsize=(30,5))
    ax = corona_gpd.plot(column='New cases', cmap='rainbow', ax=ax, legend=True, legend_kwds={'label': 'New Cases by Country'})

    Continue reading...

Compartilhe esta Página