0

I want to locate and map some photos in QGIS. The photos come from other people (not from my album). Is it possible to get the location and metadata of some tagged photos from flickr? Is it possible to do it in some automatic or massive way? (I'm not really interested in the images or their resolution but in the metadata).

I'm trying to use the Flickr Metadata Downloader plugin (v.4.0) but unfortunately it doesn't work. I'm using QGIS 3.18.0-Zurich (and have also tried using version 3.16 LTR) and WGS 84 EPSG 3857.

I have signed up for the flickr API and I have my key to run it. I have installed the experimental plugin, created the required espatialite DB and provided the N-S latitude and W-E longitude. But the result is always the same: after a bit of running with no errors, unexpected end and QGIS hangs.

Some help?

[plugin data]

[qgis error]


I've just installed the flickrapi from OSGeo4W, apparently with success. Then I've started QGIS and looked in the plugins, but I can't see the new flickr plugin (searching all plugins and with experimental ones enabled). OS install

5
  • 2
    There are various Python libraries to communicate with the flickr api, for example: pypi.org/project/flickrapi. Install through the OSGeo4W shell to use in the QGIS console
    – Matt
    Commented Mar 16, 2022 at 20:13
  • sorry Matt, I'm not very skilled at this. How can I install the API?
    – david
    Commented Mar 20, 2022 at 9:07
  • I am using the standalone installer. Do I need to use the OSGeo4W network installer? I've just downloaded flickrapi-2.4.0.tar.gz file from your link. Is this the file or do I need the other flickrapi-2.4.0-py2.py3-none-any.whl? And finally, how can I install it? Thanks
    – david
    Commented Mar 20, 2022 at 9:51
  • landscapearchaeology.org/2018/…
    – Matt
    Commented Mar 20, 2022 at 15:31
  • It is not a plugin, it is a Python library, a wrapper for the flickr API. It can be queried via the Python console. Refer to a tutorial such as this to see how to run Python commands/scripts in QGIS. Namely, sections Running PyQGIS code in console and Creating PyQGIS scripts. Some knowledge of JSON and Python dictionaries and lists is required also. It may not suit your needs but if you are keen to automate tasks like this, it is worth learning some Python.
    – Matt
    Commented Mar 20, 2022 at 21:57

2 Answers 2

2

That would depend on whether the images are geotagged or not. Download one of the images then use something line ExifTool to print out the EXIF information. Post the results to you posting. If the images have latitudes and longitudes stored in the EXIF header you could map the location of the GNSS enabled camera at the time of image capture.

1

Using flickrapi Python library to query the flickr API

import flickrapi
import json
import random

api_key = 'your_api_key'
api_secret = 'your_api_secret'

# create API instance
flickr = flickrapi.FlickrAPI(api_key, api_secret, format='json')

# arbitrary point somewhere in center of Paris
x,y = 2.360430, 48.862375
# search radius (default is km)
radius = 2

# photo tags to search
tags = 'velo, pigeon'

# query the database for geotagged, public photos, ensuring safe search
response = flickr.photos.search(has_geo=1, lon=x, lat=y, radius=radius, safe_search=1, privacy_filter=1, tags=tags)

# jsonify the response string
data = json.loads(response)

# get list of photos from response
photos = data['photos']['photo']

# pick a random photo for example
n_photos = len(photos)
rand_idx = random.randint(0, n_photos)
_photo = photos[rand_idx]
_id = _photo['id']

# print metadata and exif data
_metadata = flickr.photos.getInfo(api_key=api_key, photo_id=_id)
_exif = flickr.photos.getExif(api_key=api_key, photo_id=_id)
    
print(_metadata, _exif)

Output:

b'{"photo":{"id":"51934281767","secret":"94297d869a","server":"65535","farm":66,"dateuploaded":"1647167702","isfavorite":0,"license":"0","safety_level":"0","rotation":0,"originalsecret":"3e0fcbc53f","originalformat":"jpg","owner":{"nsid":"7815453@N05","username":"paspog","realname":"Pascal POGGI","location":"Paris, France","iconserver":"7885","iconfarm":8,"path_alias":"paspog"} ... etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.