Which are the main metrics for the project by using Geopandas, Folium , Matplotlib¶
Here more info about Acquamat, a crowdsourced map of drinking water spots scattered throughout all cities around Europe,based in Naples, with the aim of encouraging the use of a public water, reducing the purchase of water plastic bottles.
- Here the imports to script
In [1]:
import geopandas
import folium
import matplotlib.pyplot as plt
- Function To show the values on the bar
In [2]:
def showValue(ax):
for p in ax.patches:
b = p.get_bbox()
ax.annotate(int(b.y1), (((b.x0 + b.x1)/2)-0.1 , b.y1+0.1 ))
- Data repository
In [3]:
quartieri_na = geopandas.read_file("https://maps.nicoladeinnocentis.it/quartieri-na-fontanelle/src/fontanelle_x_quartiere.json")
fontanelle = geopandas.read_file("https://raw.githubusercontent.com/deinic/fontanelle/main/fontanelle.json")
municipalita = geopandas.read_file('https://raw.githubusercontent.com/deinic/fontanelle/main/municipalita.geojson')
- SPATIAL JOIN data
In [4]:
fontanelle_in_municipalita = fontanelle.sjoin(municipalita,how="inner",predicate="intersects")
pop_area_quartieri=quartieri_na.sjoin(municipalita,how="inner",predicate="intersects")
- Pie Chart in % of total number of Drinking spot water per district
In [5]:
numero_totale_fontanelle_in_municipalita= fontanelle_in_municipalita.dissolve(by='municip' , aggfunc='count')
numero_totale_fontanelle_in_municipalita.plot(kind="pie",y='node',legend=False,autopct='%1.1f%%',title='Numero Totale di Fontanelle per Municipalità in %')
ntfm=numero_totale_fontanelle_in_municipalita.plot(kind="bar",y='node',legend=False,title='Numero Totale di Fontanelle per Municipalità')
showValue(ntfm)
