Skip to main content

A little tool to show a simple window with a map based on exif gps location.

Project description

ExifMapOverlay

The purpose of this tool is to show a simple small map overlay when viewing photos. Intended as a nice gimmick when reviewing vacation photos. If a jpeg contains GeoLocation Data, fetch a map and place name from OpenStreetMap and display a small window always on top for a few seconds, then autoclose the map again.

I use IrfanView as image viewer, but I felt it misses this feature (in stock IrfanView, you need to press I🡒E🡒O (Info🡒Exif🡒OpenStreetMap) to view a map in the browser), with this utility, you can just assign it as external editor in IrfanView and then press ⇧ Shift + 1 to open the map.

Here is what the overlay looks like:

Map Overlay of Bichlbach

Installation

Dependencies for this project are Pillow, request and OSMPythonTools. The latter has quite a few dependencies itself.

To install, you need python version 3. Simplest way is then to use pip with

pip install exifMapOverlay

Compiling to executable

You may want to package this into its own "standalone" executable. In that case, I recommend to first create a new virtual python environment and then use PyInstaller with the --onedir argument. The most straightforward way to get an executable is to create a new folder, open up a terminal inside that folder (under Windows use Powershell) and paste the following lines

python -m venv emoInstallEnv
./emoInstallEnv/Scripts/activate
pip install exifMapOverlay[installer]
python -m PyInstaller ./emoInstallEnv/Lib/site-packages/exifMapOverlay/__main__.py -n exifMapOverlay --onedir --hide-console hide-early --icon ./emoInstallEnv/Lib/site-packages/exifMapOverlay/resources/logo_emo.ico --distpath ./dist --exclude-module numpy
cp ./emoInstallEnv/Lib/site-packages/exifMapOverlay/resources/ ./dist/exifMapOverlay/_internal/exifMapOverlay/resources -r
rm exifMapOverlay.spec
rm -r ./build
rm -r ./emoInstallEnv

This should leave you with the folder structure

.
└── dist
    └── exifMapOverlay
        ├── exifMapOverlay.exe
        └── _internal

that contains the packaged program. If you want to move the program, just move the whole folder exifMapOverlay, i.e. the folder _internal must be kept next to the executable. Once you have this executable, you can use it on another cmoputer with teh same operating system even if python is not installed, since the needed python libraries are kept in the _internal folder.

In my expecrience, the folder _internal should end up taking about 50MB of disk space (which I know is a lot for a simple tool like this.) Due to the many dependencies of OSMPythonTools, there will be quite a few files in this folder that are not actually needed, but I can't say which exactly. The exclusion of numpy is highly recommended though, since on some distribtions, this may ship with MKL and be >500MB then.

Usage

Call exifMapOverlay with the path to a jpeg file as single argument. If you have installed it as a python module, use

python -m exifMapOverlay somePhoto.jpg

If you have packaged it with PyInstaller, use

exifMapOverlay.exe somePhoto.jpg

General usage

The map window can be dragged around with the mouse. The current position will be saved for the next program start. You may want to set the Nominatim place names to a fixed language, to do so, edit the settings file. See Settings on how to find it.

Usage with IrfanView

If you are using IrfanView (such as myself), you can simply set up exifMapOerlay as an external editor, which will allow you to bring up the overlay from IrfanView by pressing e.g. ⇧ Shift + 1. To do so navigate to Options🡒Properties🡒Miscellaneous and add the path to exifMapOverlay.exe (e.g. C:\Users\sayofan\portableApps\exifMapOverlay\exifMapOverlay.exe) as one of the external editors. There is no need to add any arguments, as IrfanView will automatically pass the current file name as first argument.

Settings

There are a few simple settings like position of the window which are kept in a .json file. The file is stored under {system temp folder}/ExifMapOverlay/emo_settings.json and will be created upon the first execution of exifMapOerlay with default parameters. For windows, the path might be e.g. C:\Users\sayofan\AppData\Local\Temp\ExifMapOverlay\emo_settings.json

The contents of the settings file are

{
    "window_pos_x": 200,
    "window_pos_y": 100,
    "nominatim_language": null,  // null for native names; otherwise a http Accept-Language header (e.g. "de-DE")
    "tile_server_url_template": "https://tile.osm.org/{z}/{x}/{y}.png",  // # OSM tile server. For a list, see https://wiki.openstreetmap.org/wiki/Raster_tile_providers
    "tile_size_px": 256,  // the side length of the tiles. must be matched to the server. usually 256 or 512.
    "map_zoom_level": 6,  // tile zoom level, see https://wiki.openstreetmap.org/wiki/Zoom_levels
    "map_pixel_size_x": 200,
    "map_pixel_size_y": 200,
    "place_text_font_size": 12,
    "approx_display_time_ms": 6000
}

To set e.g. english names, you can edit the fourth line of this file to

"nominatim_language": "en",

Remarks

This project uses OSMPythonTools to access Nominatim and a slightly modified Static Map (modified for caching) to access map tiles from OpenStreetMap. Downloaded data is cached as required by OSM when using their APIs. I do not set an expiration date for the cache, it is simply stored in the system's tempfolder.

Please respect the usage policies of any tile server you use.

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

exifmapoverlay-1.0.0.tar.gz (120.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

exifmapoverlay-1.0.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file exifmapoverlay-1.0.0.tar.gz.

File metadata

  • Download URL: exifmapoverlay-1.0.0.tar.gz
  • Upload date:
  • Size: 120.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for exifmapoverlay-1.0.0.tar.gz
Algorithm Hash digest
SHA256 102b01f404825febb3caa0c6bd4717e1755493af43fa28f8270595b374ce9b1a
MD5 3ff006f6fc1e2116087bc4c6edc71f13
BLAKE2b-256 006a55bd9948eaf9c64f406d94b7bed2a5491fd8b46ca9dd16a0c10ca3bb2881

See more details on using hashes here.

File details

Details for the file exifmapoverlay-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: exifmapoverlay-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for exifmapoverlay-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c81e4ad8df65599cecd218e4dbc7ddcd2a7389f2949bc462a123ea404f3b262
MD5 4051e23674e01cb78ecf04932efede1a
BLAKE2b-256 055f5bda969db20c5b80bcd0df821da3c2b0a1497dddd255072d77ea49c21adb

See more details on using hashes here.

Supported by

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