F.3 Preparing the WMTS Service for MapViewer

To prepare for using the WMTS Service for MapViewer, follow these major steps:

F.3.1 Prepare Predefined Geometry Themes

If the getFeatureInfo service must get feature information from a predefined geometry theme , you must use the <hidden_info> element with one or more <field> child elements. The column attribute in the <field> element will be returned in a getFeatureInfo response.

The <hidden_info> element must be in the <styling_rules> element. For example:

<?xml version="1.0" standalone="yes"?>
<styling_rules>
  <hidden_info>
        <field column="NAME" name="name"/>
        <field column="MAINPAGE" name="mainpage"/>
  </hidden_info>
  .
  .
  .
</styling_rules>

For information using styling rules in a predefined geometry theme, see Styling Rules in Predefined Spatial Geometry Themes

F.3.2 Prepare the Base Map

To prepare a base map (which is just a collection of themes) to use a WMTS theme, add the theme to the base map.

For information about adding themes to a base map, see Maps.

For information about WMTS themes, see WMTS Themes.

F.3.3 Prepare Tile Layers

A MapViewer tile layer becomes a WMTS layer in the MapViewer WMTS server if there are no constraints in the wmtsConfix.xml policy file. For example, assume that a base map named DEMO_MAP has been created as in Example F-2, then tile layers can be created using that base map. This topic contains the following examples, each using a well-known scale set found in OGC WMTS 1.0.0 implementation standard Annex E:

In these examples, the <tile_dpi> and <tile_meters_per_unit> elements are specified, to comply with the OGC WMTS 1.0.0 implementation standard where pixel size is 0.28mm. If the coordinate (spatial reference) system is WGS84, then 1 degree on the equator equals 111319.49 meters.

Example F-9 Tile Definition of Scale Set GlobalCRS84Scale

insert into user_sdo_cached_maps values(
'WMTS_E1',
'wmts annex e1 scale set for GlobalCRS84Scale',
'',
'YES',
'YES',
'<map_tile_layer name="WMTS_E1" image_format="PNG" http_header_expires="168.0" concurrent_fetching_threads="3">
   <internal_map_source base_map="DEMO_MAP" data_source="MVDEMO" />
   <coordinate_system srid="8307" minX="-180" maxX="180" minY="-90" maxY="90"/>
   <internal_map_source base_map="DEMO_MAP" data_source="MVDEMO" db_tile_table=""/>
   <cache_storage root_path=""/>
   <coordinate_system srid="8307" minX="-180" maxX="180" minY="-90" maxY="90"/>
   <tile_image width="256" height="256"/>
   <tile_dpi value="90.7142857"/>
   <tile_meters_per_unit value="111319.49079327358"/>
   <zoom_levels levels="21" min_scale="100" max_scale="5.0E8">
      <zoom_level scale="5.0E8" tile_width="321.9561978791382" tile_height="321.9561978791382"/>
      <zoom_level scale="2.5E8" tile_width="160.9780989395691" tile_height="160.9780989395691"/>
      <zoom_level scale="1.0E8" tile_width="64.39123957582764" tile_height="64.39123957582764"/>
      <zoom_level scale="5.0E7" tile_width="32.19561978791382" tile_height="32.19561978791382"/>
      <zoom_level scale="2.5E7" tile_width="16.09780989395691" tile_height="16.09780989395691"/>
      <zoom_level scale="1.0E7" tile_width="6.439123957582764" tile_height="6.439123957582764"/>
      <zoom_level scale="5.0E6" tile_width="3.219561978791382" tile_height="3.219561978791382"/>
      <zoom_level scale="2.5E6" tile_width="1.609780989395691" tile_height="1.609780989395691"/>
      <zoom_level scale="1.0E6" tile_width="0.6439123957582763" tile_height="0.6439123957582763"/>
      <zoom_level scale="5.0E5" tile_width="0.32195619787913815" tile_height="0.32195619787913815"/>
      <zoom_level scale="2.5E5" tile_width="0.16097809893956908" tile_height="0.16097809893956908"/>
      <zoom_level scale="1.0E5" tile_width="0.06439123957582764" tile_height="0.06439123957582764"/>
      <zoom_level scale="5.0E4" tile_width="0.03219561978791382" tile_height="0.03219561978791382"/>
      <zoom_level scale="2.5E4" tile_width="0.01609780989395691" tile_height="0.01609780989395691"/>
      <zoom_level scale="1.0E4" tile_width="0.006439123957582764" tile_height="0.006439123957582764"/>
      <zoom_level scale="5.0E3" tile_width="0.003219561978791382" tile_height="0.003219561978791382"/>
      <zoom_level scale="2.5E3" tile_width="0.001609780989395691" tile_height="0.001609780989395691"/>
      <zoom_level scale="1.0E3" tile_width="6.439123957582763E-4" tile_height="6.439123957582763E-4"/>
      <zoom_level scale="5.0E2" tile_width="3.2195619787913813E-4" tile_height="3.2195619787913813E-4"/>
      <zoom_level scale="2.5E2" tile_width="1.6097809893956906E-4" tile_height="1.6097809893956906E-4"/>
      <zoom_level scale="1.0E2" tile_width="6.439123957582763E-5" tile_height="6.439123957582763E-5"/>
   </zoom_levels>
</map_tile_layer>',
'DEMO_MAP','');

Example F-10 Tile Definition of Scale Set GlobalCRS84Pixel

insert into user_sdo_cached_maps values(
'WMTS_E2',
'wmts annex e2 scale GlobalCRS84Pixel',
'',
'YES',
'YES',
'<map_tile_layer name="WMTS_E2" image_format="PNG" http_header_expires="168.0" concurrent_fetching_threads="3">
   <internal_map_source base_map="DEMO_MAP" data_source="MVDEMO"/>
   <coordinate_system srid="8307" minX="-180" maxX="180" minY="-90" maxY="90"/>
   <tile_image width="256" height="256"/>
   <tile_dpi value="90.7142857"/>
   <tile_meters_per_unit value="111319.49079327358"/>
   <zoom_levels levels="19" min_scale="1104.360027711047" max_scale="795139219.9519541">
      <zoom_level scale="795139219.9519541" tile_width="512.000000" tile_height="512.000000"/>
      <zoom_level scale="397569609.9759771" tile_width="256.000000" tile_height="256.000000"/>
      <zoom_level scale="198784804.9879885" tile_width="128.000000" tile_height="128.000000"/>
      <zoom_level scale="132523203.3253257" tile_width="85.333333" tile_height="85.333333"/>
      <zoom_level scale="66261601.66266284" tile_width="42.666666" tile_height="42.666666"/>
      <zoom_level scale="33130800.83133142" tile_width="21.333333" tile_height="21.333333"/>
      <zoom_level scale="13252320.33253257" tile_width="8.5333333" tile_height="8.5333333"/>
      <zoom_level scale="6626160.166266284" tile_width="4.2666666" tile_height="4.2666666"/>
      <zoom_level scale="3313080.083133142" tile_width="2.1333333" tile_height="2.1333333"/>
      <zoom_level scale="1656540.041566571" tile_width="1.0666666" tile_height="1.0666666"/>
      <zoom_level scale="552180.0138555236" tile_width="0.3555555" tile_height="0.3555555"/>
      <zoom_level scale="331308.0083133142" tile_width="0.2133333" tile_height="0.2133333"/>
      <zoom_level scale="110436.0027711047" tile_width="0.0711111" tile_height="0.0711111"/>
      <zoom_level scale="55218.00138555237" tile_width="0.0355555" tile_height="0.0355555"/>
      <zoom_level scale="33130.80083133142" tile_width="0.0213333" tile_height="0.0213333"/>
      <zoom_level scale="11043.60027711047" tile_width="0.00711111" tile_height="0.00711111"/>
      <zoom_level scale="3313.080083133142" tile_width="0.00213333" tile_height="0.00213333"/>
      <zoom_level scale="1104.360027711047" tile_width="7.111111E-4" tile_height="7.111111E-4"/>
   </zoom_levels>
</map_tile_layer>',
'DEMO_MAP',
'');

Example F-11 Tile Definition of Scale Set GoogleCRS84Quad

insert into user_sdo_cached_maps values(
'WMTS_E3',
'wmts annex e3 scale set GoogleCRS84Quad',
'',
'YES',
'YES',
'<map_tile_layer name="WMTS_E3" image_format="PNG" http_header_expires="168.0" concurrent_fetching_threads="3"> 
   <internal_map_source base_map="DEMO_MAP" data_source="MVDEMO"/>
   <coordinate_system srid="8307" minX="-180" maxX="180" minY="-90" maxY="90"/>
   <tile_image width="256" height="256"/>
   <tile_dpi value="90.7142857"/>
   <tile_meters_per_unit value="111319.49079327358"/>
   <zoom_levels levels="19" min_scale="2132.729583849784" max_scale="559082264.0287178">
      <zoom_level tile_width="360.0000" tile_height="360.0000" scale="5.590822640287178E8"/>
      <zoom_level tile_width="180.0000" tile_height="180.0000" scale="2.795411320143589E8"/>
      <zoom_level tile_width="90.0000" tile_height="90.00000" scale="1.3977056600717944E8"/>
      <zoom_level tile_width="45.0000" tile_height="45.00000" scale="6.988528300358972E7"/>
      <zoom_level tile_width="22.5000" tile_height="22.50000" scale="3.494264150179486E7"/>
      <zoom_level tile_width="11.2500" tile_height="11.25000" scale="1.747132075089743E7"/>
      <zoom_level tile_width="5.6250" tile_height="5.62500" scale="8735660.375448715"/>
      <zoom_level tile_width="2.8125" tile_height="2.81250" scale="4367830.1877243575"/>
      <zoom_level tile_width="1.40625" tile_height="1.40625" scale="2183915.0938621787"/>
      <zoom_level tile_width="0.703125" tile_height="0.703125" scale="1091957.5469310894"/>
      <zoom_level tile_width="0.3515625" tile_height="0.3515625" scale="545978.7734655447"/>
      <zoom_level tile_width="0.17578125" tile_height="0.17578125" scale="272989.38673277234"/>
      <zoom_level tile_width="0.087890625" tile_height="0.087890625" scale="136494.693366386"/>
      <zoom_level tile_width="0.0439453125" tile_height="0.0439453125" scale="68247.34668319"/>
      <zoom_level tile_width="0.02197265625" tile_height="0.02197265625" scale="34123.6733415"/>
      <zoom_level tile_width="0.010986328126" tile_height="0.010986328126" scale="17061.8366707"/>
      <zoom_level tile_width="0.0054931640633" tile_height="0.0054931640633" scale="8530.91833539"/>
      <zoom_level tile_width="0.00274658203168" tile_height="0.00274658203168" scale="4265.45916769"/>
      <zoom_level tile_width="0.001373291015841" tile_height="0.001373291015841" scale="2132.72958384"/>
   </zoom_levels>
</map_tile_layer>',
'DEMO_MAP',
'');

Example F-12 Tile Definition of Scale Set GoogleMapsCompatible

insert into user_sdo_cached_maps values(
'WMTS_E4',
'wmts annex e4 scale set',
'',
'YES',
'YES',
'<map_tile_layer name="WMTS_E4" image_format="PNG" http_header_expires="168.0" concurrent_fetching_threads="3">
   <internal_map_source base_map="DEMO_MAP" data_source="MVDEMO"/>
     <coordinate_system srid="3857" minX="-20037508" maxX="20037508" minY="-20037508" maxY="20037508"/>
       <tile_image width="256" height="256"/>
       <tile_dpi value="90.7142857"/>
       <tile_meters_per_unit value="1"/>
       <zoom_levels levels="19" min_scale="2132.729583849784" max_scale=" 559082264.0287178">
         <zoom_level tile_width="4.0075016692E7" tile_height="4.0075016692E7" scale="5.5908226403E8"/>
         <zoom_level tile_width="2.0037508346E7" tile_height="2.0037508346E7" scale="2.7954113201E8"/>
         <zoom_level tile_width="1.0018754173E7" tile_height="1.0018754173E7" scale="1.3977056601E8"/>
         <zoom_level tile_width="5009377.086486" tile_height="5009377.086486" scale="6.9885283004E7"/>
         <zoom_level tile_width="2504688.543243" tile_height="2504688.543243" scale="3.4942641502E7"/>
         <zoom_level tile_width="1252344.27162" tile_height="1252344.27162" scale="1.747132075089E7"/>
         <zoom_level tile_width="626172.135810" tile_height="626172.135810" scale="8735660.3754487"/>
         <zoom_level tile_width="313086.067905" tile_height="313086.067905" scale="4367830.1877243"/>
         <zoom_level tile_width="156543.033952" tile_height="156543.033952" scale="2183915.0938621"/>
         <zoom_level tile_width="78271.5169763" tile_height="78271.5169763" scale="1091957.5469311"/>
         <zoom_level tile_width="39135.7584882" tile_height="39135.7584882" scale="545978.77346554"/>
         <zoom_level tile_width="19567.8792441" tile_height="19567.8792441" scale="272989.38673277"/>
         <zoom_level tile_width="9783.93962204" tile_height="9783.93962204" scale="136494.69336638"/>
         <zoom_level tile_width="4891.96981102" tile_height="4891.96981102" scale="68247.346683193"/>
         <zoom_level tile_width="2445.98490551" tile_height="2445.98490551" scale="34123.673341596"/>
         <zoom_level tile_width="1222.99245275" tile_height="1222.99245275" scale="17061.836670798"/>
         <zoom_level tile_width="611.496226378" tile_height="611.496226378" scale="8530.9183353991"/>
         <zoom_level tile_width="305.748113189" tile_height="305.748113189" scale="4265.4591676995"/>
         <zoom_level tile_width="152.874056594" tile_height="152.874056594" scale="2132.7295838498"/>
       </zoom_levels>
</map_tile_layer>',
'DEMO_MAP',
'');

F.3.4 Publish Tile Layers in the wmtsConfig.xml Policy File

To publish tile layers, you can edit and add information in the <public_datasources> element in the wmtsConfig.xml policy file, which is stored in the same location as mapViewerConfig.xml. Example F-13 shows the entries for publishing five tiles in data source MVDEMO (TEST_EL, WMTS_E1, WMTS_E2, WMTS_E3, and WMTS_E4) and all tile layers in data source TILSMENV.

Example F-13 Publishing Tile Layers

<public_datasources>
  <public_datasource name="MVDEMO">
    <tile_layers>
      <tile_layer name="TEST_TL"/>
      <tile_layer name="WMTS_E1"/>
      <tile_layer name="WMTS_E2"/>
      <tile_layer name="WMTS_E3"/>
      <tile_layer name="WMTS_E4"/>
    </tile_layers>
  </public_datasource>
  <public_datasource name="TILSMENV" include_all_tile_layers="TRUE">
</public_datasources>

F.3.5 Verify the MapViewer WMTS Service

To verify that the MapViewer WMTS service is working properly, follow these steps:

  1. Restart the MapViewer server to let MapViewer retrieve the tile layer definitions from the data source and apply the WMTS policy file.

  2. Issue a GetCapabilities request in the following format, to check that the tile layers are published and that all scale sets are shown as expected:

    http://<url>:<port>/mapviewer/wmts?REQUEST=GetCapabilities&SERVICE=WMTS&VERSION=1.0.0

F.3.6 Tips for Creating a WMTS Compliant Custom Tile Layer

This section describes a few tips to help you to publish a basemap that was prepared for creating a MapViewer internal tile layer to MapViewer's WMTS services.

You can perform the following steps to create an OGC WMTS compliant tile layer in MapViewer. The instructions assume the following:

  • A basemap BMTEST already exists.
  • TL_28351 is the name of the new tile layer.
  • SRID is 28351, and the unit is in meters.
  • The reference scale series is set as - [500_000, 250_000, 100_000, 50_000, 25_000, 10_000, ……, 500, 250, 100, 50].
  • The new tile layer's scale series is a subset of the reference scale series.
  1. Determine the map centroid (center_X, center_Y) as shown in the following steps.
    1. Display the basemap BMTEST in MapBuilder.
    2. Determine the map's data bounds (minX, minY, maxX, and maxY) using MapBuilder's zoom and pan buttons.
    3. Compute the map's centroid as shown:
      (minX+maxX) / 2.0 => center_X;
      (minY+maxY) / 2.0 => center_Y;
  2. Determine the smallest scale as shown in the following steps.
    1. Display the basemap BMTEST in MapBuilder.
    2. Zoom-out to ensure the whole map area is smaller than 256 by 256 pixels in MapBuilder.
    3. Select scale from the drop-down list on MapBuilder's user interface as shown.

      Figure F-4 Scale Selection in MapBuilder



    4. Round up the scale value to the nearest larger scale in the reference series to get the smallest scale's denominator.
      For example, if MapBuilder's scale value is 67_890, then round it up to the nearest larger value found in the reference series, which is 100_000. The tile layer's smallest scale will then be 1/100_000.
  3. Derive the tile layer's data bounds.
    Since a tile's dimension is 256 by 256 pixels, each pixel is 0.28mm (according to OGC WMTS specification). The tile's width (in meters) on the ground at zoom level 0 is: data_bounds_Width = 100_000 * 0.00028 * 256. This size will cover the whole map area.

    The tile layer's data bounds can be computed as:

    • tilelayer_minX = center_X - data_bounds_Width /2.0;
    • tilelayer_maxX = center_X + data_bounds_Width /2.0;
    • tilelayer_minY = center_Y - data_bounds_Width /2.0;
    • tilelayer_maxY = center_Y + data_bounds_Width /2.0;
  4. Determine the largest scale.

    You may take a reasonable value from the reference series, such as a value of 100, as the largest map scale's denominator, so that the largest scale will be 1/100.

    Optionally, if you have a detailed imagery, you may use MapBuilder to determine the largest scale. In MapBuilder, zoom in the imagery to get to the finest details you want to display on the map. Then read its map scale as a reference value. Round this reference value down to the nearest smaller scale in the reference scale series. For example, if the MapBuilder's scale is 129, then round it down to 100, as the largest scale's denominator.

By following the preceding steps, you have computed the required parameters to define your custom OGC WMTS compliant tile layer. You can then create this tile layer definition using one of the following - Oracle Map Builder Tool, MapViewer's administrative console, or a sql script string that contains the XML definition of the map layer.

The following shows an example to create a custom OGC WMTS compliant tile layer. The XML definition of the map layer in referenced in the sql script as shown:

INSERT INTO user_sdo_cached_maps VALUES(
'TL_28351',
'OGC WMTS compliant tile layer',
'',
'YES',
'YES',
'<map_tile_layer name="TL_28351" image_format="PNG" http_header_expires="168.0" concurrent_fetching_threads="3" fetch_larger_tiles="false"
    persistent_tiles="true">
   <internal_map_source base_map="BMTEST" bgcolor="none" out_of_bounds_color="#ffffff"/>
   <tile_storage root_path=""/>
   <coordinate_system srid="28351" minX="382582" maxX="389750" minY="6523739" maxY="6530907"/>
   <tile_image width="256" height="256"/>
   <tile_dpi  value="90.7142857"/>
   <tile_meters_per_unit  value="1"/>
   <zoom_levels levels="10" min_scale="100" max_scale="100000">
      <zoom_level scale="100000"/>
      <zoom_level scale="50000"/>
      <zoom_level scale="25000"/>
      <zoom_level scale="10000"/>
      <zoom_level scale="5000"/>
      <zoom_level scale="2500"/>
      <zoom_level scale="1000"/>
      <zoom_level scale="500"/>
      <zoom_level scale="250"/>
      <zoom_level scale="100"/>
   </zoom_levels>
</map_tile_layer>',
'BMTEST',
'');