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 Location Intelligence 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. Register your implementing class in the java.properties file by setting its full name as the value for the maptiling.tilecache.class key.

    The java.properties file is located in the Spectrum_install_dir/server/modules/spatial directory.

  4. Pull the named configuration file for the Map Tiling Service (MapTilingConfiguration.xml) out of the repository using your favorite 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 favorite WebDAV tool.
  7. Do one of the following to reload the Map Tiling Service configuration:
    • Restart the web service.
    • Use the Spectrumâ„¢ Technology Platform JMX Console (available at http://server:port/jmx-console) to reload the configuration without restarting the web service.

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