Skip to main content

Simple command-line tool to generate a KML from the georeferenced photos in a Flickr album

Project description

flickr2kml

Simple command-line tool to generate a KML from the georeferenced photos in a Flickr album

Install

The tool requires Python 3.6+.

To install, launch :

pip install flickr2kml

The command above will install the flickr2kml Python library and its dependencies. The library includes a command-line script, also named flickr2kml, whose functionality is described below.

Usage

Use the --help flag to get an overview of the arguments:

~$ flickr2kml --help
Usage: flickr2kml [OPTIONS] OUTPUT_KML

  Generate a KML file for the georeferenced photos in a Flickr album

Options:
  -f, --flickr_album TEXT         URL of Flickr album  [required]
  -t, --template [gearth|mymaps]  Choice of placemark description format
                                  [default: gearth]

  --api_key TEXT                  Flickr API key  [required]
  --api_secret TEXT               Flickr API secret  [required]
  -p, --pushpin                   Flag to make each placemark a simple pushpin
                                  instead of a small image

  --config FILE                   Path to optional config file for the Flickr
                                  API credentials [default :
                                  /Users/guilhem/Library/Application Support/f
                                  lickr2kml/flickr_api_credentials.txt]

  -d, --debug                     Flag to activate debug mode
  --help                          Show this message and exit.

Some notes:

  • The URL of the Flickr album must be something like https://www.flickr.com/photos/o_0/albums/72157716704507802
  • The API keys and secrets can be obtained by registering a non-commercial application with Flickr at https://www.flickr.com/services/api/misc.api_keys.html Since the API has limits on how many calls can be made per hour, I cannot share my own key.
  • A config file is optional and, if present, can contain values for the api_key and api_secret arguments. It should be a text file with the content like this:
api_key="<Flickr API Key>"
api_secret="<Flickr API Secret>"

(the quotes should be present)

  • The default location depends on the OS (the one shown above is for my macOS machine) but can be shown with the --help switch. That location can be overriden with the --config option.
  • If there is no config file, the key and secret can be passed as options on the command line or as environment variables (FLICKR_API_KEY and FLICKR_API_SECRET).
  • There are 2 different formats for the description fields in the KML placemarks. I personnally generate KML for use either in Google Earth (gearth format) or Google My Maps (mymaps format). They don't present the content of the fields the same way (nor support the same features). The default is the Google Earth format.

Example

flickr2kml -f https://www.flickr.com/photos/o_0/albums/72157716046011583 thiou2020.kml

If the API key and secret come from a config file, there is no need to pass them as argument.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flickr2kml-0.2.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

flickr2kml-0.2-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page