py-openaq
py-openaq copied to clipboard
Add geo-mapping functionality
Make it easy for people to make nice geo-maps.
I don't know if this has been discussed but I strongly suggest the folium library as a candidate. My running example goes like this:
import openaq
import folium
api = openaq.OpenAQ()
locs = api.locations(country='CH', df=True)
basemap = folium.Map(location=[locs['coordinates.latitude'].mean(),
locs['coordinates.longitude'].mean()],
zoom_start=8)
locs.apply(lambda row: folium.Marker((row['coordinates.latitude'],
row['coordinates.longitude']),
popup = row.to_json()).add_to(basemap),
axis=1)
basemap.save('airquality.html')
Hey @sergiolucero I would suggest adding a few examples to the gallery if you have some time (I'm currently swamped and will be until I defend next spring...). If you need help figuring out how to do that, let me know and I can lend a hand on instructions.
Hi @dhhagan I think I just created my first pull request. Does it need to pass any tests? I guess I need to modify requirements.txt as well?
Hey @sergiolucero. There are unit tests it must pass and it looks like it's failing right now, but not because of your additions. I'll try and take a look later to see what's going on. You shouldn't need to edit the requirements.txt
file as I don't think folium
should be a requirement for installation - it will only be needed if geo-maps are to be built/used. Eventually, if there is a function of some sort for using folium within the library, it will be needed - but not for examples only. I will add it to the install file for travis.