Integrating the OGC WMS getcapabilities information in WordPress (iframe)

wms_tools_codeOver the last two years I have worked with WordPress as a content management system for several projects. WordPress has proved to be a flexible platform for publishing documents, files in general, imagery and maps. There was one thing missing though. I wanted to be able to list map layers available on a given wms-server.

To solve this I have now made a small php-script which allows the user to integrate server capabilities information from a geoserver based WMS-server. The code is a work in progress and does admittedly have some shortcomings.

The feature would not be possible without wms-parser.php and Openlayers.

The code is basically just a php driven html/javascript-page processed and embedded into a WordPress page using the iframe plugin. The php code sends a request to a wms-server and uses that information to make a page containing highlights from a server. It also sets up links to the Geoserver in question so that the files can be viewed on that server or data downloaded.

Data requested from a wms-server is presented like this.

Data requested from a wms-server is presented like this. Using OpenLayers the main map provides all layers for browsing, and the list below has a map thumbnail, some meta data and links.

A live example is available on a separate page:


Cross platform compatibility has not been properly implemented. Since we are talking about a standard here I guess I could nudge the code a bit and make it work towards mapserver and esri wms-servers as well.

The wms-parser script to my knowledge origins from the drupal module called Carto. This should place the code securely within the GPL framework. A nice piece of code – but it unfortunately does not work well in PHP 5.4

The code I have written is not very sophisticated. The CSS files are used only in part. The layout provided could admittedly be better. It is all very messy. But in the spirit of publishing often and early this is what you get.

The good part

It works and that’s really what counts for me now. The code is available on GitHub, so if anyone feels the code should be forked or if anyone wants to contribute with code or bug descriptions it’s just to go to the projecct page on github.


Thanks to Tobin Bradley, Kjetil Pettersson, Ingunn Limstrand and Kato Phillip for comments, help and inputs along the way.

Leave a Reply

Your email address will not be published. Required fields are marked *