As I mentioned earlier, my current compact travel-zoom camera is the excellent Panasonic DMC-TZ40. As it saves the GPS coordinates with every photo I take I thought it’d be a fun little exercise to try and script the extraction of this metadata, with a view to plotting the points on a map or even better - drawing a line between them all so I could retrace my steps!
Looping through files is pretty trivial in all programming and scripting languages, and most if not all of them already have JPEG libraries that allow for the straightforward extraction of the photo metadata. The final piece was finding a suitable output format that would be understood for rendering points and lines on maps. Enter KML:
Keyhole Markup Language (KML) is an XML notation for expressing geographic annotation and visualization within Internet-based, two-dimensional maps and three-dimensional Earth browsers. - [Wikipedia](https://en.wikipedia.org/wiki/Keyhole_Markup_Language)
For the route output, the script assumes that sorting the directories and files alphabetically will result in the same order the photos were taken. This should be true and work fine in most cases. Personally, I organise my photos like so:
Viewing with Google Earth
The resulting `points.kml` opened in Google Earth
Google Earth natively supports KML, so once you have it installed and open, just go to File > Open and select either points.kml, route.kml or both!
Viewing with Google Maps
The resulting `route.kml` opened in Google Maps. A little more involved and not without some limitations..
Google Maps also understands KML files, but there are some limitations which I’ll point out in a moment.
First, head over Google Maps and sign in with your Google+ account, or create one
Next, expand the Google Maps menu by clicking on the 3 horizontal bars inside the maps search box on the left, then choose ‘My Maps’ and ‘Create’
You’ll get a new web-browser tab with a new map in it. Simply click the highlighted ‘Import’ link under the ‘Untitled layer’ and select the points.kml, route.kml or both!
Importing the KML file into Google Maps is pretty straightforward but requires a Google+ account
You’ll likely run into the following message..
Google Maps will only import the first 10 layers and 2000 features from this KML file.
For now at least, Google Maps is limited to the number of points and lines it can process. photo-mapper generates a single layer, but each photo will be a point so we’re currently limited to 2,000 geotagged photos.
Google’s retired MapsEngine could handle far more data so I think it’ll just be a matter of time before this restriction is lifted.
The Panasonic LUMIX DMC-TZ40 Digital Camera, in a word, excellent!
I recently upgraded my compact travel zoom camera from the tried and trusted Sony DMC-HX9V to the Panasonic DMC-TZ40. It’s quite an upgrade and while I’m delighted by my new purchase, the review will have to wait now that I can use a major feature: MAPS!
Maps! On a Digital Camera! What ever will they think of next!
Yes, as well as GPS Geotagging of photographs, the Panasonic LUMIX DMC-TZ30 (ZS20) and Panasonic LUMIX DMC-TZ40 (LZ30) come with Map Data that you can use to find your way to your next photo shooting location, or back to your hostel if you find yourself lost!
The Map Data comes on the CD-ROM / DVD with the camera, along with a little application called the LUMIX Map Tool. There’s a version for Microsoft Windows and Apple Mac OSX, but not for Linux.
To save on space I’d copied the contents of the DVD onto a USB drive so I could update the map data while travelling, but the only thing that didn’t copy was the Apple Mac OSX version of the LUMIX MapTool.pkg!
A couple of things caught me out when I was trying to deploy a Django application to Windows Azure, so I’m making a note of them here for future reference. Oh, and I hope they might be of use to you as well
Configuring Azure Websites to run Python and Django
The Windows Azure Websites and Django getting started tutorial directs us to put the required settings into the Azure management portal, but that’s not how Microsoft do it in the Gallery, oh no. If we create a Django application from the Windows Azure Website gallery, the resulting site puts all the configuration into a web.config.
Personally, I like the management portal approach, but I did play with the web.config and got it working for my custom site, so I present it here in case this works for you:
There are three things you need to do to get this working:
Check the PYTHONPATH - It needs pointing to the root of your Django Application (the directory that holds manage.py, and the location of the directory site-packages (obviously, copy that directory into Azure from your development environment if it’s not there)
Set DJANGO_SETTINGS_MODULE - Point this to your settings.py file. Replace directory slashes / with dots, and omit the .py from the end
Create the file handler.fcgi - This is required, and it’s a just a plain text file containing two double-quotes (i.e. "") on the first line followed by a return carriage
Following the advice in settings.py the first thing I did after copying the files into Azure and seeing the Django “cool, now get cracking” default page was to trip DEBUG to False (DEBUG = False), then refresh the web browser..
Django on Windows Azure Websites - Bad Request (400)
Essentially, if DEBUG is False, we have to put our server’s URL into the ALLOWED_HOSTS setting. Now, we could do that in settings.py but this is really Azure specific just like the configuration above, so it really belongs in Azure.
In the Azure management portal, under the “Website > Configure” tab, find the “app settings”; section near the bottom and add the following:
Your Azure URL: e.g. mydjangosite.azurewebsites.net
If you have custom domains pointed at Azure, you can use a space-separated list like so: mydjangosite.azurewebsites.net myjangosite.com
While we're adding new application settings, create a new 50 character random string and copy it here. We'll use it in a second
Now, we could just modify our settings.py, but it’s much better to have a configuration file specifically for production / Azure, so first of all, copy your existing settings.py to a new file in the same directory - I like to use the filename settings_azure.py.
Now, assuming you have a shiny new settings_azure.py file, delete everything in it and replace it with this:
Now just overwrite the important settings
SECURITY WARNING: keep the secret key used in production secret!
SECURITY WARNING: don’t run with debug turned on in production!
Handy file logging, in case we run into problems on production
If you created this new settings_azure.py file, don’t forget to adjust the DJANGO_SETTINGS_MODULE value to point to it in the Azure management portal, or your web.config if you went that route, you heathen!