Map Photos with uMap and PHP

If you happen to use a photo publishing application like Mejiro that stores photos and their thumbnails in regular directories, you can automatically map your photos with uMap and a dash of PHP scripting. Better still, there is no need to write PHP code from scratch: you can use a quick-and-dirty PHP script as a starting point.

The script goes through each photo in the specified directory and pulls the photo’s geographical coordinates, its full path, and the path to the related thumbnail. The script then outputs the obtained data in the comma-separated format.


Copy the code, and paste it into a new text file. Specify the correct values for the $url, $photos and $thumbnails variables, and save the script under the csv.php name. Move the resulting file to the root of your photo sharing app installation. To see whether the script works properly, point your browser to (replace and photos with the actual server IP address or domain name and directory containing photos). You should see output that looks something like this:

lat,lon,thumbnail,photo 49.477116899982,10.988667,,

Next, sign in to uMap and click the Create a map button to create a new map. In the right panel, click Manage layers. Click the Edit button next to the default layer, and give it a descriptive name. Expand the Remote data section, enter the URL to the PHP script in the Url field, and choose csv from the Format drop-down list. Enable the Dynamic and Proxy request options. Expand then the Interaction options section, and enter the following into the Popup content template field:

Source: {photo}

Save and reload the map, and you should see markers for each photo. Click on the marker to open its popup containing a thumbnail and the link to the source photo.

This is an excerpt from the Linux Photography book. Get your copy here.


Tech writer covering Linux and open source software

Tagged with: , ,
Posted in Open Source, Photography, Software

Recipes for automated and streamlined photographic workflow on Linux

Use digiKam? Get this book!

Practical advice for nighttime photography

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: