3

Is it somehow possible to get layer's column name using OpenLayers? any example and documentation would be really useful?

Edit: I have already tried WMS_describeLayer topp:states layer:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE WMS_DescribeLayerResponse
  SYSTEM 'http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_DescribeLayerResponse.dtd'>
<WMS_DescribeLayerResponse version="1.1.1">
    <LayerDescription
      name="topp:states"
      owsType="WFS"
      owsURL="http://localhost:8080/geoserver/wfs/WfsDispatcher?" 
      wfs="http://localhost:8080/geoserver/wfs/WfsDispatcher?">
        <Query typeName="topp:states"/>
    </LayerDescription>
</WMS_DescribeLayerResponse>
6

You have to use WFS describeFeatureType request for the layer (typename in the request) to retrieve information about columns (feature attributes).

http://yourserversurl/wfs?request=describeFeatureType&typename=topp:states

Since you asked how to make it with WMS I guess iant indicated how you can start from there. So first step is how to switch to wfs and for be able to do that you have to know the url of wfs. So DescribeLayer request can help there...

0
2

The WMS standard provides an optional DescribeLayer request which will provide you with the WFS URL and featureType(s) included in the layer. From that information you can construct a WFS getFeatureDescription request for the feature(s) and from that determine the column names.

OpenLayers may provide some tools for doing this but I've never seen them.

4

Your Answer

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

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