I’ve been working with a mix of technologies lately that includes Node and GeoServer. I’ve recently begun integrating the two by using Node to manipulate GeoServer’s configuration through the REST API it provides for that purpose. One task I’ve been working on automating is the registration of vector layers stored in PostGIS with GeoServer to make them available via WMS, WFS, and the various other services provided by GeoServer.
One could legitimately ask why such a thing would need to be automated. GeoServer provides a perfectly serviceable administration interface (shown above) and such functions are not traditionally the domain of external applications. I’ve been doing a lot of technical work lately in support of open data requirements for some government users. While, in a perfect world, all data would just be open, reality is a bit more complicated. Data typically needs to be taken through a process to ensure that it does not contain sensitive information, such as personal identification or financial information and the like. A good example of these kinds of requirements is available in the text of Maryland’s Open Data Act (PDF), for example.
These requirements imply configuration management and publication workflows, and this is where external applications come into play. Many governments also have requirements that spatial data be exposed as OGC-compliant services and this is where GeoServer is unsurpassed.
So let’s get started. What I need my application to do is to expose an existing PostGIS table to GeoServer, which means adding a new feature type. For purposes of this discussion, we will assume that a workspace and a data store have already been created.
This example is fairly straightforward. As I move along, I’ll deal with raster data sources as well as removing layers. Although the need to integrate administrative functions for external software can seem a little counter-intuitive at time, it’s good that GeoServer exposes such function via an API, to make it easier to automate higher-level business workflows. With this type of automation, GeoServer can be a full-fledged citizen in automated business processes.