13. .php Download photos from a .csv Observations Export

Here (attached file) a simple php script for download all photos from a csv observations export.
You have to install a php interpreted on your computer.
The csv file must be named "observations.csv" and it must contains at least the "id" and "image_url" field.
run: php photo_download.php
The script download all photos in the same directory as the php script.
When you export the observations either from http://www.inaturalist.org/observations/export or from the links form your project page, the CSV you get has an image_url column with a link to the photos.

There are browser plugins, little freeware programs, or you can write very simple scripts (perl/php etc.) that fetch photos using a list of URLs

There is only the url of the first image in the csv when there are more images per observation.


$row = 0;
$image_url_field = false;
$id_field = false;

if (($handle = fopen("observations.csv", "r")) !== false) {

while (($data = fgetcsv($handle, 0, ",")) !== false) {

$num = count($data);

if ($image_url_field === false) {
for ($c=0; $c < $num; $c++) {
if ( $data[$c] == "image_url" ) {
$image_url_field = $c;

if ( $data[$c] == "id" ) {
$id_field = $c;



if ($image_url_field === false) {
die ("Missing image_url field");
} else if ($id_field === false) {
die ("Missing id field");
} else if ($row < 2) {

if (empty($data[$image_url_field])) {

$original_image_url = str_replace("medium", "original", $data[$image_url_field]);
$image = file_get_contents($original_image_url);
$extension = preg_match("/jpg|png|gif/i", $original_image_url, $ext);

echo "Download: " . $original_image_url . "\n";

if (isset($ext[0])) {
file_put_contents("observation_" . $data[$id_field] . "." . $ext[0], $image);
} else {
file_put_contents("observation_" . $data[$id_field], $image);





66. Interactions, Relaties, Verbondheid

more details here: https://forum.inaturalist.org/t/add-interactions-to-species-pages/433/16 here are many ways. Have a look at

Now a lot depends on your philosophy.

For instance you can just add an interaction (one of the many fields): and name the other side of the interaction.
But that assumes that you know the other organism, and that if you have it wrong you will fix it, and that if the name changes taxonomically, then you will fix it.

see https://www.inaturalist.org/projects/specific-animal-plant-interactions

My philosophy is that you put both as observations and then link them: that way the community takes care of the identifications, and the link will remain no matter what.
If you follow my philosophy look at:

How can we get this higher up the “desired” list of features?
Both the New Zealanders and southern Africans have projects dealing with this.
Ours is visible at https://www.inaturalist.org/projects/interactions-s-afr 4

Basically, we record only the active interaction (i.e. “a eats b”, not “b is eaten by a” - the latter just being the reciprocal of the first), although user pressure has resulted in us adding a passive field for the reciprocal observation, given that observations fields link only one way, so that these observations do not display their hosts) as:

Visiting flowers: https://www.inaturalist.org/observations?field:Visiting%20a%20flower%20of:%20(Interaction) 6
Eating: https://www.inaturalist.org/observations?field:Eating:%20(Interaction) 5
Parasitizing: https://www.inaturalist.org/observations?field:Parasitizing:%20(Interaction) 1
Attached to: https://www.inaturalist.org/observations?field:attached%20to:%20(Interaction)
Carrying: https://www.inaturalist.org/observations?field:Carrying:%20(Interaction) 1
Associated with: https://www.inaturalist.org/observations?field:Associated%20with:%20(Interaction)
& the passive

Note that in each case the field value is the url of the interacting observation. Unfortunately we cannot use this is a query to summarize the interactions.
We can ask
“What flowers does the Cape Sugarbird Visit?” - https://www.inaturalist.org/observations?place_id=113055&subview=grid&taxon_id=13442&field:Visiting%20a%20flower%20of:%20(Interaction)= 3
but we will only see the bird, and not the flowers, even though all the urls to the flowers are in the field - see: https://www.inaturalist.org/observation_fields/7459 2.

In over 5 years of using this “set” of interactions, we have never had a request to add additional interactions (e.g. Eating = preys on = killing to eat - i.e. “killing for fun” has not cropped up), although it would be nice to have a hierarchical dictionary of interactions (e.g. visiting a flower > pollinating a flower (> for nectar, pollen, oil, gum)/robbing a flower/, etc

I’m happy to leave the test=interactions thing available, I’m just not going to make it visible by default or integrate it into the UI. I don’t think we need to ice this topic, as I think the title sums up what we want pretty well. Personally, I think the Feature Requests category is a way to gauge what kinds of things people are interested in, and not necessarily specific implementation plans, so it’s valuable to me to know how many people chose to upvote this. In fact, I will spend one of my votes on it right now

plant Lantana camara apparently “visits flowers of” 46 species of insects, rather than the other way around https://www.inaturalist.org/taxa/50333-Lantana-camara?test=interactions 13). Is it a functionality you can leave available, or are there reasons not to do so?

We investigated this when we redesigned the taxon page in 2016 (yikes, that was a while ago). I just made it so you can see what we did by appending test=interactions to any taxon page URL, and I’ll use examples to explain why we didn’t develop this any further.

The big problem looming over this whole feature is that observation fields are a bad way to model interactions. Since they represent a totally uncontrolled vocabulary, they’re rife with synonymous fields, so it’s hard interpret situations where, for example, there are both eats and preys on interactions, e.g. https://www.inaturalist.org/taxa/117520-Enhydra-lutris-nereis?test=interactions 28. What’s the difference? Why are both supported?

Another problem is that using observation fields to model interactions means that one of the two taxa in the interaction is not subject to crowdsourced identification, so anyone can say that oaks eat humans and there’s nothing the community can do to correct that. As an example, here’s a butterfly that supposedly eats itself: https://www.inaturalist.org/taxa/51097-Papilio-zelicaon?test=interactions 16. It doesn’t, this is just due to an erroneously added observation field. Site curators could just delete this field, but that’s generally not how we like to perform quality control at iNat.

On top of that, we really wanted to incorporate data from GLoBI 12, since we like them and we think it’s cool that they incorporate iNat interaction data, but mapping taxonomies and field semantics proved a hassle, and again it presents the problem of data that the iNat community can’t correct if they find errors.

What we’d like to do is to make a new feature for interactions where an interaction is a relationship between two observations with clear and controlled semantics (to the extent that that’s possible). So instead adding an obs field that says an obs of an oak represents that oak eating a human, you would create an interaction and have to choose two observations, one of an oak and another of a human, and choose “eating” from a menu of interaction types where “eating” means “taxon A is putting all or part of taxon B inside its body for the purpose of personal metabolism” or something. Other users could then vote on whether that was the correct interaction type, and the two observations could be independently identified. We could try and pre-populate this new kind of data with observation fields, or at least make a tool that helps people review their own interaction obs fields to make new-style interactions out of them. That’s a lot more work, though, and it hasn’t really been a priority, so we haven’t gotten around to it.

Anyway, that’s a long way of saying that I agree this would be cool, but doing it right will take considerable effo

Publicado el 13 de octubre de 2018 a las 08:54 PM por ahospers ahospers



Open source Rails app behind iNaturalist.org

Want to help out? Fork the project and check out the Development Setup Guide (might be a bit out of date, contact kueda if you hit problems getting set up).

Thinking about running your own version of iNaturalist? Consider joining the iNaturalist Network instead of forking the community. https://github.com/inaturalist/inaturalist

Search Term and Tricks
Russell Pfau's iNat tips & tricks
Cassi Saari's iNat tips & tricks

Anotado por ahospers hace casi 6 años

Añade un comentario

Entra o Regístrate para añadir comentarios