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:
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!