Upload Scripts

Here's a post for those of you who upload from a computer, because you use other cameras like GoPro or Garmin Virb, or because you offload photos when your phone is getting full. In our Mapillary Tools repository we have the tools you need. Just clone or download to get started.

There are two cases and two different kinds of uploads. The first is when you upload photos taken with the Mapillary app. The second is when you upload photos from other cameras. Let's look at each of them.

Photos from the Mapillary app

This is the easy case. Because the apps embed all information needed in the photo's EXIF information (inside the Image Description tag) all you need to do is to get the photo to the right server. Since the photos are self-contained it doesn't matter who does the uploading. You can collect photos from many users to one computer and upload all at once. They will be correctly sorted in sequences and assigned the right photographer.

Just run the script upload.py with the folder containing your photos as argument, like this:

$ python upload.py path

After successful upload the photo will be moved to a subfolder of where you run the script (named 'success'). This is so that in case you loose your connection or have to abort, you can just start again and not worry about uploading the same photo twice. Tip: run the script from a separate folder.

Photos from other cameras

With photos from other cameras, the photos don't contain all the information we need. For example, there is no sequence id indicating which photos belong together, and there is no information on which user took the photos.

One option is to use the web uploader and select photos sequence-by-sequence. Since you are logged in to the Mapillary website, and select which photos go together, we have everything that's needed. Using the web uploader is a liitle cumbersome if you have a lot of photos.

The second option is to use the upload_with_authentication.py script. As the name says, you need to authenticate so Mapillary can see who uploaded. To do this, you first need to go to this page while you are logged in in your browser. Then take the two hashes and save them as environment variables together with your Mapillary username. For example:

$ export MAPILLARY_SIGNATURE_HASH="your signature hash"
$ export MAPILLARY_PERMISSION_HASH="your permission hash"
$ export MAPILLARY_USERNAME="jesolem"

Next you need to group the photos into folders of sequences. Just copy manually or use the time_split.py script, also part of the tools you downloaded. See here on how to use that.

Finally, you can upload each sequence by supplying the path to the folder. Like this:

$ python upload_with_authentication.py path

The photos are also moved to a subfolder 'success' after sucessful upload.


In both scripts there are checks for the necessary EXIF tags. You will have to install the exifread module. For example using pip:

$ pip install exifread

Happy mapping with your GoPros and Garmins!

/Jan Erik

Tags for this post:
comments powered by Disqus