Updated Python Upload Script

After a few rainy days I managed to come up with a python script using pyinaturalist which is at least as efficient as the existing upload method. For people uploading a large number of photos of the same species it is much more efficient.

The basic workflow is to put all the photos in a folder with the common name or scientific name and/or taxon number as the name of the folder.



You can put dozens of photos in any of these folders, so uploading fifty observations of the same species only requires running the script once. All the photos in every folder in the master folder will be uploaded as an individual observation.

What about uploading multiple photos to the same observation? This isn't much harder, add the photos to a sub-folder in the species folder. The script doesn't care what name, so I usually just leave these as "new folder." All the photos in this subfolder will be uploaded to an individual observation.

When you run the script, it gives you a few inputs to fill out:



The more annoying of these are "APP ID" and "APP Secret." You have to create an app for iNaturalist to upload through scripts. Fortunately this just takes a few seconds. The folder it wants is the main folder which contains all the species folders to be uploaded. Even if you are uploading just one species the folder with the photos will need to be in a master folder containing nothing but species folders to be uploaded.

Chances are you will want to go in the code and fill out default values for most of the entries so you will not have to fill them out every time you run the script. It is commented where to add them to the import_gui.py file.

Once the script is done, it moves all the files out of this folder, and puts them next to the main folder in a folder called "Uploaded." This should keep you from re-uploading everything if you lose connection mid-upload. Just run the script again, all the uploaded photos will now be gone. 

Since it got rather long, I uploaded it to Github as iNaturalist-Uploads. There are three files which all must be in the same folder. upload_folders.py is the file which is run as a python script. The other two (import_gui.py and import_functions.py) have functions which I preferred to put in a different folder to keep it less messy. All three files need to be saved to the same folder to run.

This probably doesn't make sense for most users as it is way less intuitive than the site submission tool, but if you are experienced with python or have a ton of photos of a limited number of species to upload this starts to make sense.

Publicado el febrero 11, 2019 05:19 MAÑANA por glmory glmory

Comentarios

Uploaded 479 observations this weekend using the script. Unfortunately had a bug where it was using time of photo creation rather than capture time. That put the incorrect time on most of these observations, but was easy enough to fix.

Does seem faster than using the site, but easier to misidentify observations and harder to add fields. Will have to think about updating those.

Publicado por glmory hace alrededor de 5 años

Hi glmore, Is there a way to find all children from pyinaturalist on github?

Publicado por optilete hace casi 5 años

Interesting question, the only way I can think of is from a google search. I don’t use github that much though so I might be missing a newer method.

Pyinaturalist is quite new, so there may be nothing else. But if everyone who makes observations with python scripts posted their code I suspect great improvements could be made.

Publicado por glmory hace casi 5 años

I ran into this example of a pretty well documented pyinaturalist script:
https://medium.com/@johannes.t.klein/how-to-upload-many-observations-to-inaturalist-at-once-baf5b7eb113a

Publicado por glmory hace casi 5 años

Hey @glmory, found your forum thread yesterday and was looking at your code ---do you mind if I fork it and do some playing around? I wouldn't want to be presumptuous and send commits straight back to you since I don't know if you're looking for contributions directly.

Obviously I can gladly report back here or start my own discussion once I get something going.

Publicado por theyeti hace casi 5 años

Yeah, I am a relatively new coder who was doing this as much as a way to learn Python as anything else. So if you find ways to improve it, than it would certainly be of interest. I at least have been successfully been using this script about two months now so it isn't so bad.

As I see it, the step which needs more thought is what is the most efficient way to:

Connect the species name with the photos
Connect the photos together when multiple photos need to go into one observation.

The system I have works really well when uploading a few hundred photos of 1 species with 1 photo per observation. It works alright with multiple species one photo per observation as I just make a folder for each species. Connecting multiple photos to one observation by making a sub folder seems a bit clunky though. To go that far efficiently probably needs a real GUI.

Also, a way to not force every user to make their own app secret and name would be nice.

Publicado por glmory hace casi 5 años

Agregar un comentario

Acceder o Crear una cuenta para agregar comentarios.