Images as Maps
This is a Python script: download
it as a raw file,
togeo.py. You’ll need GDAL for
it to work – not necessarily the ‘python bindings’, but make sure that,
in your terminal,
gdalinfo are present.
Run the script with a single filename as its argument:
python togeo.py pie.jpeg
This will generate
What I mean by ‘geo-referenced’ is that the
tif file is now a GeoTIFF
file – a TIFF file with special information about what projection it’s in
and where its corners are in the world. This script transforms the image
into the spherical mercator projection,
and then does some extra legwork to make sure that its corners are referenced
in a way that respects the image’s aspect ratio.
The way that it does that is pretty simple: the maximum bounds of a GeoTIFF
in EPSG:900913 is
-20037508.34, -20037508.34, 20037508.34, 20037508.34.
togeo.py simply crops this either widthwise or lengthwise to fit a
smaller area and preserve the image’s dimensions.
From there, you can use it in TileMill or your favorite GeoTIFF-supporting application (QGIS is another good one) easily!
- GSV by Mike Migurski doesn’t make any geo-assumptions and includes a Python script for tiling.
- Zoomify takes the product angle and is popular with photographers.
- You can hack the Google Maps API to produce a similar effect, or use OpenLayers
- If your images have something to do with the world, and you want to combine them with other maps, none of these techniques will work: you should check out image rectification. Map Warper and Map Knitter are great options for doing that.