You want to automate the configuration of the data offering of an OGC Web Feature Service (WFS), Web Map Service (WMS), or Web Coverage Service (WCS).

Why do it?

The LuciadLightspeed OGC web services (WMS, WFS, WCS) come with a server sample that assembles its data offering through a set of configuration files. In operational environments, you probably want to automate such a process, and make use of components that automatically determine the data offering, such as a component that scans a folder for newly added files. In this article, you can learn how to configure an automated offering for your own OGC web service.

How to do it?

LuciadLightspeed includes a ready-to-use OGC server sample, with support for WFS, WMS and WCS. For each web service protocol, the OGC server sample relies on a configuration file that defines its data offering. The following steps explain how to customize the data offering process.

The web service protocol determines which API you can use to configure the offered data, but the concepts are all similar: for each service, there is a *CommandDispatcherFactory class that configures the entire server for a protocol. The class typically has access to a list of decoders, or offerings, that defines the data to be served.

Configuring the WMS data offering

API entry point

The entry point is ALcdOGCSLDWMSCommandDispatcherFactory.createWMSCapabilitiesDecoder().

This method needs to return an ILcdWMSCapabilitiesDecoder, which is responsible for defining an ALcdWMSCapabilities instance. The ALcdWMSCapabilities instance holds all data about WMS-related capabilities: layer offerings, output formats, service metadata, and so on.

ALcdOGCSLDWMSCommandDispatcherFactory is an extension of ALcdOGCWMSCommandDispatcherFactory that includes built-in support for SLD requests. Therefore, it comes recommended if you want your WMS to support custom data styling requests now or in the future.

Sample

In the samples, you can find an implementation of ILcdWMSCapabilitiesDecoder that reads the necessary input (data input, metadata) from an XML file: see LuciadLightspeed_*/samples/src/samples/wms/server/config/xml/WMSCapabilitiesXMLDecoder. You can also check the example XML file LuciadLightspeed*/build/ogc/resources/wms.capabilities.cfg.xml.

Configuring the WCS data offering

API entry point

The entry point is ALcdOGCWCSCommandDispatcherFactory.createCoverageOfferingList().

This method needs to return an ILcdCoverageOfferingList instance, which is responsible for defining the listed coverages.

Sample

In the samples, you can find an implementation of ILcdCoverageOfferingList that gets its configuration from an XML file: see LuciadLightspeed_*/samples/src/samples/ogc/wcs/server/WCSCoverageProvider and LuciadLightspeed_*/samples/src/samples/ogc/wcs/server/WCSCommandDispatcherFactory.createCoverageOfferingList(). You can also check the example XML file: LuciadLightspeed_*/build/ogc/resources/wcs.coverages.cfg.xml.

Configuring the WFS data offering

API entry point

The entry point is ALcdOGCWFSCommandDispatcherFactory.createWFSFeatureTypeListDecoder().

This method needs to return an ILcdWFSFeatureTypeListDecoder , which is responsible for defining an ILcdWFSFeatureTypeList instance. The ILcdWFSFeatureTypeList instance holds the feature types offered by the WFS.

Sample

In the samples, you can find an implementation of ILcdWFSFeatureTypeListDecoder that gets its configuration from an XML file: see LuciadLightspeed_*/samples/src/samples/ogc/wfs/server/WFSFeatureTypeListDecoder. You can also check the example XML file: LuciadLightspeed_*/build/ogc/resources/wfs.featureTypeList.xml.

Testing the OGC server sample

You can easily run the OGC server (WMS, WFS, WCS) sample again to test your changes:

  • From an IDE: compile and run the class samples.ogc.server.Main with the argument -fromsource

  • From the command line: run the script LuciadLightspeed_*/build/ogc/deploy_ogc_service.bat with the argument build_development_war. When the script has finished, run the samples.ogc.server.Main OGC server sample.