Getting the WMTS capabilities

You can find out what the capabilities of a WMTS source are, if you provide the URL of the service.

Once you have the capabilities data, you can inspect it to customize the request for the creation of the WMTS model.

If an error occurs during the capabilities retrieval, you can inspect the returned object to learn the reason of the error.

Decoding WMTS data to a WMTS model

You create a model with the WmtsModelDecoder::decode method. This is how you set up a simple model:

Program (C++): Creating a simple WMTS model
WmtsDataSource source = WmtsDataSource::newBuilder().url("http://sampleservices.luciad.com/wmts").build();

luciad::expected<std::shared_ptr<Model>, ErrorInfo> wmtsModel = WmtsModelDecoder::decode(source);

The result is a model created from the URL you specified as a parameter. The WMTS capabilities are automatically requested. The query parameters are all set to their default settings. This means that:

  • The first layer found in the capabilities is selected.

  • The styling is set to its default style entry. If there is no default entry, the model creation fails.

  • The default format is selected from the format entries available for the layer.

If you need more control, you can make use of the WmtsDataSource structure. See this snippet for an example:

Program (C++): Creating a precise WMTS model
WmtsDataSource source = WmtsDataSource::newBuilder().url(url).layer("4ceea49c-3e7c-4e2d-973d-c608fb2fb07e").style("default").build();

luciad::expected<std::shared_ptr<Model>, ErrorInfo> wmtsModel = WmtsModelDecoder::decode(source, wmtsCapabilities);

You select all components while you are creating the source, before requesting the data. Note that only the URL is required. All other parameters will fall back to their default settings if they are not specified.

you can retrieve the capabilities earlier and specify them here, to prevent the need for a new query. However, if you do not provide them, they will be retrieved automatically.

Capabilities are used to cross-check the availability of data requested in the WmtsDataSource, and find the defaults for unavailable values.

Limitations

There are limitations in the support for the OGC WMTS protocol. For details, see the WmtsModelDecoder::decode method documentation.