Creating Custom Tiles from Images

< appboard | 2.4 | builder | widgets | tile map

The following information is provided as-is from various other sources. The Tile Map widget will accept any appropriately structured tile-set regardless how it's produced.


The first 3 sections are snapshot of the instructions found at: http://bryce-thomas.blogspot.com/2012/01/noobs-guide-to-creating-google-maps.html

Page Contents

1. Finding the geographic coordinates of the image

For a long time the hardest part has been trying to accurately figure out the coordinates of an overlay image. Things got a little easier a few months ago with the release of Overlay Tiler. A slightly modified version of the original Overlay Tiler is employed in the following steps (which you should now perform): Upload your image to a location on the Web where you can publicly link it. Dragging and dropping your image onto the imgur homepage is one option that will give you a direct link. Visit http://overlaytiler.appspot.com/. In the Enter a location box, enter the name of the landmark your image will overlay and choose one of the auto-completed options. If no appropriate auto-complete option comes up, forget about it. Paste a link to your uploaded image from Step 1 in the Upload an image to overlay box and hit Upload. Step 3 should have taken you to a page with your image overlaid on top of Google Maps. Use the green node in the centre of the image to centre the image on top of the respective Google Maps landmark (if it's not already). You can use the standard Google Maps zoom controls and also the slider in the top left hand corner to adjust the image's opacity, which will make lining things up easier. Use the three red circles on the image corners to manipulate the image until it accurately traces the landmark1. You'll notice as you do this that the command text in the bottom right hand corner continuously updates—we'll use this command in Part II to generate geographic metadata for our image.

Posted 11th January 2012 by Bryce Thomas

2. Adding geographic metadata to the image

Now that you've lined up your image over Google Maps, you're going to add some geographic metadata to your local copy of the image. Download OSGeo4W and install it. The "Express Desktop Install" is fine and you only need to tick "GDAL" when it asks you to select packages—all we want is access to the gdal_translate command. Look for OSGeo4W Shell on the Start Menu and launch it. Change into the directory with your image (e.g. cd C:\John\Pics). Copy the entire gdal_translate command from the bottom right hand corner of the Overlay Tiler Web page into the console, replacing [my_image] with the filename of your image locally. Note that you'll probably need to copy the command into something like Notepad first and remove all the backslashes and newlines, so you've got a command like: gdal_translate -gcp 0 0 178.71874950000017 -7.2265307089195225 -gcp 275 0 -128.37109424999983 -7.9235151584510195 -gcp 275 95 -128.37109424999983 -23.92125118057006 [my_image].png out.tif (all on a single line). If you try to copy it straight into the console it'll execute the first line only and complain loudly. In your image directory, you should now have a file named out.tif which looks just like your original file, but now with some hidden geographic metadata.

Posted 11th January 2012 by Bryce Thomas

3. Generating Map Tiles

Now that we've got an image with geographic metadata attached, it's time to generate the tiles. Download and install MapTiler. Start MapTiler and select Google Maps compatible when it asks you what kind of tiles you'd like to generate. Hit Continue. Add your .tif image to the source data files and hit Continue. Select WGS84 - Latitude and longitude (geodetic) as the Spatial reference system. If you hit Preview the map reference with this SRS a browser tab will open showing you the boundaries of where your image will fit on Google Maps. This should give you confidence that the georeferencing has worked. Hit Continue. Choose the zoom levels you want tiles generated for, or simply stick with the defaults. Hit Continue. Choose the directory to save the map tiles into and hit Continue. Leave the default selection of viewers and hit Continue. Change the title of the map if you want and hit Continue. Hit Render. Once rendering is done, click on the directory link MapTiler provides and you should see several numbered directories (one for each zoom level) and googlemaps.html and openlayers.html documents. Open up googlemaps.html and you should see your tiles rendered as an overlay! Try zooming in and out.

Posted 11th January 2012 by Bryce Thomas

4. Using the Custom Tiles in Appboard

Refer to the Registering Additional Tilesets docs for creating a tileset registry file and that may be sufficient if serving up the custom tiles from another web server.

Otherwise also look at Importing Tilesets to create a bundle of the images + tileset registry file for importing into the AppBoard server, and have AppBoard serve up the tiles.