Creating Your Own Tile Caching Mechanism

Depending on your organization's requirements, you may need to create your own custom tile caching mechanism. For example, the built-in tile caching mechanism included with the Spatial Module caches tiles on the file system. If instead you want to cache your tiles in a database, you will need to create your own custom tile caching mechanism.

To create your own tile caching mechanism, use the following steps:

  1. Create a Java class that implements the following interface:
    com.mapinfo.midev.service.maptiling.cache.ITileCache
    Note: Your implementing class must contain a default (no arguments) constructor.

    The ITileCache interface class is packaged in this JAR file:

    Spectrum_install_dir/server/modules/spatial/lib/midev-service-maptiling-1.3.0.jar

    For information about each of the ITileCache methods you will need to implement, see the ITileCache Javadoc file located here:

    Spectrum_install_dir/server/modules/spatial/javadoc

  2. Package your implementing class into a JAR file, and place a copy of the JAR file in this directory:

    Spectrum_install_dir/server/modules/spatial/lib

  3. Add the maptiling.tilecache.class key and full qualified class name as its value in the Management Console.
    1. Open the Management Console.
    2. From the Resources menu, select Spatial.
    3. Expand the Java Properties list.
    4. Click the Add Property button and Scroll to the bottom of the list to the new property entry.
    5. In the Name field, type maptiling.tilecache.class and in the Value field type the full qualified class name.
    6. Scroll to the top of the screen and click Save.
  4. Pull the named configuration file for the Map Tiling Service (MapTilingConfiguration.xml) out of the repository using your preferred WebDAV tool.

    The default location of the MapTilingConfiguration.xml file in the repository is:

    http://<server>:<port>/RepositoryService/repository/default/Configuration

  5. Using a text editor, add any initialization settings for the cache to the MapTilingConfiguration.xml named configuration file.

    Each initialization setting is added to a <Property> element that is a child of the <Cache> element in the configuration file. Each <Property> element has a name attribute and a value attribute which holds the name and value of the initialization setting.

  6. Re-add the named configuration file back into the repository using your WebDAV tool.

The Map Tiling Service will now use your custom tile caching mechanism to cache the map tiles.