How to replicate world tour figures?

Is there public code on github/some kind of tool that we can use to recreate the two figures on each world tour post (e.g. https://www.inaturalist.org/blog/25726-australia-inaturalist-world-tour), i.e. the map with scaled profile pics, and the line chart? (but with updated stats to reflect current numbers)

3 Likes

Not that I know of, but I’d love this too! also for any place and not just countries would be cool!.

2 Likes

Yeah, it would be nice to be able to have something like that for places and projects.

It would make a nice addition to reports for the sponsors of conservation projects and such.

2 Likes

https://inaturalist.github.io/internationals_all.html In the first week the figures updated automatically or were updated each month. Probably you can rollback some code to make it dynamic again:
https://github.com/inaturalist/inaturalist.github.io/commits/master/country_stats

2 Likes

the snapshot of the data from back in the day appears to be here: https://github.com/inaturalist/inaturalist.github.io/tree/master/country_stats

i’m guessing the way these stats were produced back then was only partly automated. so even if you got all of loarie’s code and process steps, it would probably still require someone to manually execute the process to generate the data for a place and snapshot in time.

i can envision a way to generate this information dynamically so that you would be able to just input a place id in a web page, and it would automatically generate all the figures, but that would take someone to code it. (that code does not already exist, as far as i know.)

currently, there is probably not a very efficient way to produce this map.

it’s relatively easy to figure out who the top observers are in any place / area, and it’s easy to figure out how many observations they have in the area, and it’s easy to get user profile pics.

the hard/inefficient part is positioning the markers on the map based on where the center of gravity of observations is for an observer. loarie describes generally how he’s doing it here: https://forum.inaturalist.org/t/china-inaturalist-world-tour/5440/4. he’s basically figuring out the top 50 observers in an area using the top observers API endpoint (http://api.inaturalist.org/v1/docs/#!/Observations/get_observations_observers), then downloading all observations in the area for each top observer, and then probably running it through some algorithm in R to find that center of gravity.

i can think of a potentially more efficient way to do this using UTFgrid data, but it would take some novel coding. someone would have to sit down and code things initially before it would be efficient/easy for others to generate these maps. for some insight into how UTFgrids could be used, see this (https://forum.inaturalist.org/t/looking-for-inaturalist-observation-map-visualisation-suggestions/7322/11) and subsequent posts in that thread.

if you look at this thread (https://forum.inaturalist.org/t/1m-observations-this-month/2582), you’ll find the R code that loarie is using to generate the line charts. in that same thread, i’ve provided an alternate way to get similar stats + a zoomable bar chart (not a line chart, though it would be relatively easy to switch to a line chart) without having to go through R. both these methods basically rely on the iNat API observation histogram endpoint (http://api.inaturalist.org/v1/docs/#!/Observations/get_observations_histogram). so you could also create your own chart by hitting that endpoint.

4 Likes

Thanks for the links @optilete

@pisum you’re a legend. I used everything you sent and made what I wanted for Australia (the line chart at least, still figuring out the map)

2 Likes

your chart looks great!

i’ve been halfway thinking about different ways to accomplish a completely automated map today, and i’ll probably take a stab at coding something in the morning (with the UTFgrid approach). i’m guessing loarie probably had the advantage of being able to query directly from the database to get observations. it’s not really practical to get individual observations via the API for some of the top observers because of API limits, but non-staff like us still can get bunches of observations using a CSV download (or a series of downloads). so if you’re going to try to make the map yourself, you’d want to start with the top X observers for your place, then limit your search to the place and those top observers (&user_id=reiner,questagame,etc), then export user_id+obs_id+lat+lng to CSV, then use that as your data source to find the center of mass for each of the top users. (or if you want to try to parse through UTFgrids, let me know, and i can explain the approach in more detail.)

2 Likes

I want to have a line chart for Netherlands, Belgium and Danmark. Are they timeconsuming to create?

if you already have R (+RStudio), it should be fast/easy to generate using loarie’s code in the thread that i mentioned above. if you don’t want to to use R, it might be easier to get data directly from the histogram endpoint. in the same thread, i note how to do that, and i also provide a link and code for something that i made that helps to both create a bar chart and display the API response in a little more human-readable format. so you could use the bar chart from that, or you could use the data from that to create your own chart, in your own charting program. that should be relatively fast. you could also write your own thing to pull data directly from the API. that would take some time initially, but once you have it, it should run very quickly.

here’s my thing for running for the Netherlands+Belgium+Denmark by observation created month since 2010:
https://jumear.github.io/stirfry/iNatAPIv1_observation_histogram.html?interval=month&created_d1=2010-01-01&date_field=created&place_id=7506,7008,8051.

2 Likes

Thank you. Netherlands .
total observation count: 211,384
created month max count: 54,001
max created month: 2018-08-01

Belgium.
total observation count: 163,234
created month max count: 18,572
max created month: 2020-05-01

Denmark.
total observation count: 240,111
created month max count: 63,265
max created month: 2020-05-01

https://www.inaturalist.org/observations?place_id=6734
Singapore.
otal observation count: 105,642
created month max count: 5,390
max created month: 2020-01-01

https://www.inaturalist.org/observations?place_id=6966
Indonesia.
total observation count: 162,069
created month max count: 9,644
max created month: 2019-08-01

https://www.inaturalist.org/observations?place_id=7190
Argentina.
total observation count: 220,423
created month max count: 27,039
max created month: 2020-04-01

1 Like

someone decided to attempt an ill-advised impromptu weekend construction project. so i was sidetracked when enlisted to help minimize the damage from that. but i got a top observers map working (i think) today.

page: https://jumear.github.io/stirfry/iNat_top_observers_map.html
code: https://github.com/jumear/stirfry/blob/gh-pages/iNat_top_observers_map.html

here’s an example of the map for the top 20 observers in Australia (https://jumear.github.io/stirfry/iNat_top_observers_map.html?place_id=6744&top_n=20):

you can also specify multiple places and other parameters. for example, here are the top 10 reptile observers in Netherlands+Belgium+Denmark: https://jumear.github.io/stirfry/iNat_top_observers_map.html?place_id=7506,7008,8051&&iconic_taxa=Reptilia

5 Likes

Wow, this is so awesome! I’m currently writing a synthesis paper reviewing Australia’s involvement in iNat. Can I use a screenshot from this map as one of the figures? With full acknowledgement of you of course.

yes, you’re welcome to use this as you like. you should keep the little attribution line at the bottom of the map, but i don’t need any personal attribution (though you may credit “pisum”, if you like). you should know that the center of observation density for each user is approximate, and algorithm for figuring the center doesn’t fully account for the shape of the Earth either. so it should be fine for high-level visualization, but you just shouldn’t attribute too much precision to it. (it was built more for ease of creation.)

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.