We have a webGIS app based on a GeoServer back-end serving WFS layers and a web client based on OpenLayers.

For various purposes, in the client we have a config object for the layers such as:

const layers = {
    layer1: {
        id: 0,
        typename: 'workspace:layer_name',
        title: 'my title',
        geometryType: 'Polygon',
        maxResolution: 10,
        visibility: false,
        param1: true,
    layer2: {} 

Can this config object be served somehow by GeoServer? Is there a Geoserver plugin for that? The reason is that we'd like some admin be able to change some parameters in the GeoServer admin interface without editing a line of JS.

I saw that GeoServer can serve some data about the layers as a REST service (eg: http://localhost/geoserver/rest/layers.json). Another possibility would be to extend the "GetCapabilities" (http://localhost:8001/geoserver/workspace/wfs?service=WFS&version=1.1.0&request=GetCapabilities) of the WFS to have these parameters. The solution I found at the moment is to put these parameters in the "Abstract" of each layer, so I can parse the WFS GetCapabilities request to build my config object, but this is a little bit crappy:

<Abstract>maxResolution: 10, visibility: false, param1: true</Abstract>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.