import pandas as pd
import folium
from datetime import datetime, timedelta
from pyinaturalist import (
Observation,
get_observations,
pprint,
)
from IPython.display import display, MarkdownA visit to Rwanda and Uganda
In 2022 I visited Rwanda for a meeting of the Steering Committee of the IUCN Commission on Ecosystem Management and the African Protected Areas Conference (APAC).
Here I summarise the iNaturalist observations made during this trip, including some excursions to protected areas in Rwanda, Uganda and the frontier to the DRC.
This post is still under development. I have not yet organised and uploaded all the observations, here is just a sample of them.
Load Python modules
I always start importing the python modules
Download iNaturalist observations
I use the get_observations function with a range of dates to query iNaturalist:
observations = get_observations(user_id='NeoMapas',
d1="2022-07-09",
d2="2022-07-25",
per_page=1000)Only three dozen or so observations so far (I guess this should be >60)
len(observations['results'])52
We can print them in a pretty table:
pprint(observations)ID Taxon ID Taxon Observed on User Location ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 328671725 5418 Gypohierax angolensis Jul 18, 2022 neomapas Musanze, RW-NO, RW (Palm-Nut Vulture) 328671698 14051 Lagonosticta senegala Jul 14, 2022 neomapas Musanze, RW-NO, RW (Red-Billed Firefinch) 328671648 73391 Serinus flavivertex Jul 14, 2022 neomapas Musanze, RW-NO, RW (Yellow-Crowned Canary) 328671602 13686 Genus Motacilla (Wagtails) Jul 14, 2022 neomapas Musanze, RW-NO, RW 328671573 67835 Danaus chrysippus (Plain Jul 14, 2022 neomapas Musanze, RW-NO, RW Tiger Butterfly) 328671554 149078 Genus Harpendyreus Jul 14, 2022 neomapas Musanze, RW-NO, RW 328671527 595705 Trifolium burchellianum (Wild Jul 14, 2022 neomapas Musanze, RW-NO, RW Clover) 328671508 47923 Family Lycaenidae Jul 14, 2022 neomapas Musanze, RW-NO, RW (Gossamer-Winged Butterflies) 328671485 147390 Colias electo (African Jul 14, 2022 neomapas Musanze, RW-NO, RW Clouded Yellow) 328671475 47126 Kingdom Plantae (Plants) Jul 14, 2022 neomapas Musanze, RW-NO, RW 328671453 55745 Trifolium repens (White Jul 14, 2022 neomapas Musanze, RW-NO, RW Clover) 328671384 147390 Colias electo (African Jul 14, 2022 neomapas Musanze, RW-NO, RW Clouded Yellow) 328671347 135301 Genus Dorylus (Driver Ants Jul 14, 2022 neomapas Kisoro, Kisoro, UG And Allies) 328671302 14588 Pycnonotus barbatus (Common Jul 14, 2022 neomapas Kisoro, Kisoro, UG Bulbul) 328671272 3 Class Aves (Birds) Jul 14, 2022 neomapas Kisoro, Kisoro, UG 328671264 8038 Corvus albus (Pied Crow) Jul 14, 2022 neomapas Kisoro, Kisoro, UG 328671241 2988 Streptopelia semitorquata Jul 14, 2022 neomapas Kisoro, Kisoro, UG (Red-Eyed Dove) 328303999 5268 Milvus migrans (Black Kite) Jul 22, 2022 neomapas Gasabo, RW-KV, RW 328303983 5418 Gypohierax angolensis Jul 22, 2022 neomapas Gasabo, RW-KV, RW (Palm-Nut Vulture) 328303950 5268 Milvus migrans (Black Kite) Jul 22, 2022 neomapas Gasabo, RW-KV, RW 328303937 4744 Mycteria ibis (Yellow-Billed Jul 22, 2022 neomapas Gasabo, RW-KV, RW Stork) 328303913 5268 Milvus migrans (Black Kite) Jul 22, 2022 neomapas Gasabo, RW-KV, RW 328303902 5418 Gypohierax angolensis Jul 21, 2022 neomapas Gasabo, RW-KV, RW (Palm-Nut Vulture) 328303886 372390 Milvus migrans parasitus Jul 21, 2022 neomapas Gasabo, RW-KV, RW (Yellow-Billed Kite) 328303179 372390 Milvus migrans parasitus Jul 21, 2022 neomapas kimihurura (Yellow-Billed Kite) 328303159 372390 Milvus migrans parasitus Jul 21, 2022 neomapas Kimihurura (Yellow-Billed Kite) 328299630 47126 Kingdom Plantae (Plants) Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW 328299589 245843 Subfamily Galerucinae Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW (Skeletonizing Leaf And Flea Beetles) 328299575 47126 Kingdom Plantae (Plants) Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW 328299560 47126 Kingdom Plantae (Plants) Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW 328299544 47126 Kingdom Plantae (Plants) Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW 328299524 47126 Kingdom Plantae (Plants) Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW 328299500 47126 Kingdom Plantae (Plants) Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW 328299479 47157 Order Lepidoptera Jul 11, 2022 neomapas Volcans, RW-NO-MS, RW-NO, RW (Butterflies And Moths) 328299454 68423 Junonia hierta (Yellow Pansy) Jul 10, 2022 neomapas Gasabo, RW-KV, RW 328110752 372390 Milvus migrans parasitus Jul 09, 2022 neomapas Gasabo, RW-KV, RW (Yellow-Billed Kite) 328110728 144421 Genus Spermestes (African Jul 09, 2022 neomapas Gasabo, RW-KV, RW Mannikins) 328110711 721186 Ciconia ciconia ciconia Jul 09, 2022 neomapas Gasabo, RW-KV, RW (European White Stork) 252786946 329894 Genus Desmometopa Jul 12, 2022 neomapas Rubanda, Uganda 252786184 880641 Ariadne pagenstecheri Jul 12, 2022 neomapas Rubanda, Uganda 195608311 12792 Cossypha heuglini Jul 10, 2022 neomapas Kamukina, Kigali, Rwanda (White-Browed Robin-Chat) 169357877 32837 Trioceros johnstoni Jul 12, 2022 neomapas Kisoro, Uganda (Johnston's Chameleon) 169357874 12053 Lanius mackinnoni Jul 12, 2022 neomapas Kisoro, Uganda (Mackinnon's Shrike) 169357073 147661 Gorilla beringei beringei Jul 12, 2022 neomapas (-1.0333664656, 29.6054448052) (Mountain Gorilla) 169356800 31425 Genus Acanthocercus Jul 23, 2022 neomapas Rugando, Kigali, Rwanda (Ridgeback Agamas) 169356246 121993 Lampides boeticus (Pea Blue) Jul 16, 2022 neomapas Rugando, Kigali, Rwanda 169356060 55371 Saxicola torquatus (African Jul 14, 2022 neomapas HH97+MG, Kinigi, Rwanda Stonechat) 169355583 516815 Ceryle rudis rudis (African Jul 14, 2022 neomapas Located on Lake Mulehe 10Kms Pied Kingfisher) along Kisoro-Rubuguri Rd, Uganda 169355582 5268 Milvus migrans (Black Kite) Jul 14, 2022 neomapas Located on Lake Mulehe 10Kms along Kisoro-Rubuguri Rd, Uganda 169355580 12985 Muscicapa aquatica (Swamp Jul 14, 2022 neomapas Located on Lake Mulehe 10Kms Flycatcher) along Kisoro-Rubuguri Rd, Uganda 169354601 981195 Harpendyreus reginaldi Jul 13, 2022 neomapas Mount Sabyinyo, Congo - Kinshasa 169354599 8004 Corvus albicollis Jul 13, 2022 neomapas Mount Sabyinyo, Congo - (White-Necked Raven) Kinshasa
Map of observations
I have uploaded a selection of observation from different parts of my trip, including an excursion to the Volcanos National Park in Rwanda and the Bwindi National Park in Uganda.
map = folium.Map(tiles="Esri NatGeoWorldMap")fg = folium.FeatureGroup(name="iNaturalist observations", control=True, attribution="observers @ iNaturalist").add_to(map)
popup_text = """<img src='{url}'>
<caption><i>{species}</i> observed on {observed_on} / {attribution}</caption> {desc}
"""
for obs in observations['results']:
if obs['quality_grade'] == 'research':
if obs['description'] is None:
desc = ""
else:
desc = obs['description']
pincolor = 'green'
else:
desc = "Observation is not research quality grade."
pincolor = 'gray'
fg.add_child(
folium.Marker(
location=obs['location'],
popup=popup_text.format(
species=obs['species_guess'],
observed_on=obs['observed_on'],
desc=desc,
url = obs['observation_photos'][0]['photo']['url'],
attribution = obs['observation_photos'][0]['photo']['attribution']),
icon=folium.Icon(color=pincolor),
)
)
folium.LayerControl().add_to(map)<folium.map.LayerControl object at 0x12d917c80>
map.fit_bounds(map.get_bounds())
mapTravel log
records=list()
for obs in observations['results']:
record = {
'uuid': obs['uuid'],
'quality': obs['quality_grade'],
'description': obs['description'],
'location': obs['place_guess'],
'longitude': obs['location'][1],
'latitude': obs['location'][0],
'species guess': obs['species_guess'],
'Fecha': obs['observed_on'],
}
if len(obs['observation_photos'])>0:
record['url'] = obs['observation_photos'][0]['photo']['url']
record['attribution'] = obs['observation_photos'][0]['photo']['attribution']
records.append(record)inat_obs=pd.DataFrame(records)inat_obs["dia"]=inat_obs.Fecha.apply(datetime.date)inat_obs.groupby('dia').agg({'uuid': ['count'],'species guess': ['count',pd.Series.nunique]})| uuid | species guess | ||
|---|---|---|---|
| count | count | nunique | |
| dia | |||
| 2022-07-09 | 3 | 3 | 3 |
| 2022-07-10 | 2 | 2 | 2 |
| 2022-07-11 | 8 | 1 | 1 |
| 2022-07-12 | 5 | 5 | 5 |
| 2022-07-13 | 2 | 2 | 2 |
| 2022-07-14 | 20 | 18 | 17 |
| 2022-07-16 | 1 | 1 | 1 |
| 2022-07-18 | 1 | 1 | 1 |
| 2022-07-21 | 4 | 4 | 2 |
| 2022-07-22 | 5 | 5 | 3 |
| 2022-07-23 | 1 | 1 | 1 |
my_observations = Observation.from_json_list(observations)def day_gallery(selection, group):
photo_str="{.lightbox group='%s' height='100'}"
photo_md = list()
for obs in my_observations:
if obs.observed_on.day in selection:
photo_md.append(photo_str % (
obs.species_guess,
obs.place_guess,
obs.user.name,
obs.photos[0].medium_url,
group
)
)
display(Markdown(''.join(photo_md)))Welcome to Kigali
Mount Bisoke
Bwindi National Park
Gorilla expedition in Bwindi Impenetrable forest



















































