1

I am working on a WMS-based OpenLayers project, which is pulling in data from the BGS WMS Servers. We're pulling the 1:50k bedrock layer from this WMS:

https://map.bgs.ac.uk/arcgis/services/BGS_Detailed_Geology/MapServer/WMSServer?

In OpenLayers 3 I am trying to query the WMS and display the attributes in an iFrame beneath the OpenLayers map. Using the following code, I am able to get the full metadata to display beneath the map.

map.on('singleclick', function(evt) {
            document.getElementById('info').innerHTML = '';
            var viewResolution = /** @type {number} */ (view.getResolution());
            var url = wmsSource.getGetFeatureInfoUrl(
                evt.coordinate, viewResolution, 'EPSG:3857',
                {'INFO_FORMAT': 'text/html'});
            if (url) {
              document.getElementById('info').innerHTML =
                  '<iframe seamless src="' + url + '"></iframe>';
            }
          });

The thing is, this pulls in ALL of the metadata and I would like to restrict it to just one or two fields, such as LEX, LEX_RCS_D or MAX_TIME_D (see field names here)

I'm not a user of JavaScript, so I'm having difficulties modifying the code.

After some research online, I came across the propertyName parameter, which I've tried implementing, although I'm not even sure this is what I'm looking for.

{'INFO_FORMAT': 'text/html'}, {propertyName: 'LEX'}

Given the way the BGS WMS is configured, is it even possible to limit the attributes which are pulled out on the GetFeatureInfo request?

1 Answer 1

2

Given the way the BGS WMS is configured, is it even possible to limit the attributes which are pulled out on the GetFeatureInfo request?

No.

The propertyName parameter you have come across is a vendor specific option provided by GeoServer for WMS, but this BGS service is not a GeoServer service; so you will not be able to use propertyName to limit the attributes retrieved from a GetFeatureInfo request.

3
  • Thanks - I had wondered if I'd misunderstood a concept somewhere. There must be another BGS layer online somewhere then, because their own web map queries at the GeoIndex display selected fields only. Commented Nov 21, 2017 at 14:36
  • GeoIndex uses an ArcGIS REST interface internally, not a WMS
    – nmtoken
    Commented Nov 21, 2017 at 17:02
  • You might be able to cascade the WMS through another WMS service and limit the output that way
    – nmtoken
    Commented Nov 21, 2017 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.