wiki:SoCTMSDriver

Version 5 (modified by keo, 16 years ago) ( diff )

--

Read/Write driver for TMS tiles

This work is continuation of the SoC 2007 project GDAL2Tiles. The goal is to create a new driver for reading and writing maps in TMS tiled format.

Data format

TMS tiled maps

The driver will operate on data in the OSGeo TMS TileMap Resource format used already by GDAL2Tiles. In short, the map is described in one XML file. Image data is divided into several zooming levels represented by directories containing tiles as individual files.

Tiles

The TMS specification doesn't prescribe the format of tiles but PNG and JPEG are the only useable formats in web setting. Both have existing drivers in GDAL. The TMS driver will use only PNG tiles at first. Extending the support to JPEG tiles as well is possible next step after implementing both reading and writing functionality for PNG.

Work plan

The work is divided into several steps. First three are essential, all others are optional.

Read driver

First step is to create a read-only driver. The Open method will be called on the main XML file describing the map. The <TileSet> URLs will be expected to be paths relative to the main file. This is the case with data produced by GDAL2Tiles. When this expectation is not met, the driver could try to guess the names of directories using the last part of the URL and the base directory of the file being opened. Another approach is to use auxiliary file describing the layout, this is similar to the way the WMS driver works.

IRasterIO method will determine the appropriate zooming level from which to get the tiles so that their number won't be too big (e.g. 9 at most). GetBlockSize will report the size as the dimensions of one tile and GetXSize and GetYSize will report the size of the map on the lowest zooming level.

Write driver

Next on plan is the writing part. The driver will support both CreateCopy and Create methods. Creation options will include the dimensions of tiles, number of zooming levels and the zooming ratio between them. Upon writing, the RasterIO method will load all affected tiles from all zooming levels into memory, perform the write operation and then write the tiles back to file system.

NODATA

The map doesn't neccesarily need to have a rectangle form and the driver should be supportive in this. It could report data from missing tiles as NODATA and not write them to file system unless the user performs write operation on them. This way the map could be stored compactly.

Performance tuning

The reading strategy at this point will be probably quite simple -- creating new datasets for appropriate tiles in the IReadBlock method and getting data from them. This could prove to be inefficient. There are several ways to solve this issue:

  • Holding all tiles opened -- could be wasting too much memory.
  • Managing a cache of recently used tiles.
  • Prefetching adjacent tiles into the cache.

These and other should be explored and the final solution selected based on measured performance.

HTTP Read driver

The TMS tiled maps are mostly used on web, so the ability to read the map from http connection could be quite useful. This step is somewhat related to the preceding one because without intelligent caching, the performance could very well become unacceptable.

Student info

My name is Václav Klusák and I am a graduate student of Applied Informatics at Masaryk University in Brno, Czech Republic. I can be reached by email (keo@keo.cz) or ICQ (247 160 335).

Note: See TracWiki for help on using the wiki.