The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Geo::OGC::Service::WMTS - Perl extension to create geospatial web map tile services

SYNOPSIS

The process_request method of this module is called by the Geo::OGC::Service framework.

In a psgi script write something like

 use Geo::OGC::Service::WMTS;

 my $ogc = Geo::OGC::Service->new({
 config => '/var/www/etc/OGC-services.conf',
 services => {
        'WFS' => 'Geo::OGC::Service::WFS',
        'WMTS' => 'Geo::OGC::Service::WMTS',
        'WMS' => 'Geo::OGC::Service::WMTS',
        'TMS' => 'Geo::OGC::Service::WMTS',
 }});

 builder {
    mount "/WFS" => $ogc->to_app;
    mount "/WMTS" => $ogc->to_app;
    mount "/TMS" => $ogc->to_app;
    mount "/" => $default;
 };

DESCRIPTION

This module aims to provide the operations defined by the Open Geospatial Consortium's Web Map Tile Service standard.

This module is a plugin for the Geo::OGC::Service framework.

Additionally, this module aims to support WMS used as WMTS and TMS.

CONFIGURATION

The configuration is defined similarly as to other services under Geo::OGC::Service, either as a file or as a variable in the call to Geo::OGC::Service->new.

The file must be JSON and either have top level key WMTS, WMS, or TMS if more than one service is defined. The value of the key must be a hash, or the name of a key, which has a hash value.

Known top level keys in the hash are 'resource', 'blank', 'debug', and 'TileSets'. TileSets is an array of hashes. The keys of a TileSet hash are Layers, Format, Resolutions, SRS, BoundingBox, path, and ext.

EXPORT

None by default.

METHODS

process_request

The entry method into this service. Calls RESTful if there is no request parameter, otherwise dispatches the call to WMSGetCapabilities, GetCapabilities, GetTile, GetMap, or FeatureInfo depending on service and request. If request is not recognized, returns an error XML with exceptionCode => 'InvalidParameterValue'.

GetCapabilities

Sends a capabilities document according to WMTS standard.

WMSGetCapabilities

Sends a capabilities document according to WMS standard.

GetMap

Serves the tile request if WMS is used.

Sends the requested tile based on parameters BBOX and LAYERS.

The tiles should be in a tile map resource type of directory structure (z/y/x.png). The value of the 'path' key in the TileSet config element should point to the directory.

GetTile

Serves the tile request if WMTS is used.

Sends the requested tile based on parameters Layer, Tilerow, Tilecol, Tilematrix, Tilematrixset, and Format.

The tile is served from a tile map directory or it is made on the fly from a GDAL data source (the value of the 'file' key in the TileSet). In addition, processing may be applied to the data source (the 'processing' key). The processing may be one of those implemented in GDAL.

Using the 'file' keyword requires GDAL 2.1.

Keyword RESTful (0/1) controls the ResourceURL element in the capabilities XML. Default is false.

RESTful

RESTful service. The URL should have the form <service>/layer/<TileMatrixSet>/<TileMatrix>/<TileCol>/<TileRow>.<ext>. TileMatrixSet is optional. Compare this to the template in capabilities.

Sends TileMapService response if the layer is not in the URL, TileMap response if the layer is in the URL but zoom, row, and col are not, or the requested tile based on layer, zoom, row, and column in the URL.

FeatureInfo

Not yet implemented.

LIMITATIONS

Currently only EPSG 3067 (ETRS-TM35FIN) and 3857 (Google Mercator) are supported. To support other tile matrix sets add them to %Geo::OGC::Service::WMTS::projections.

SEE ALSO

Discuss this module on the Geo-perl email list.

https://list.hut.fi/mailman/listinfo/geo-perl

For the WMTS standard see

http://www.opengeospatial.org/standards/wmts

REPOSITORY

https://github.com/ajolma/Geo-OGC-Service-WMTS

AUTHOR

Ari Jolma, <ari.jolma at gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2015 by Ari Jolma

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.22.0 or, at your option, any later version of Perl 5 you may have available.