Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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>
share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

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...

share|improve this answer
add comment

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.

share|improve this answer
    
I can't see feature type or am I wrong somewhere? This edit is from demo Test Servlet. –  kinkajou Sep 18 '12 at 8:17
    
<Query typeName="topp:states"/> –  iant Sep 18 '12 at 8:23
    
so still confused .... –  kinkajou Sep 18 '12 at 9:45
    
@iant Can you help retrieving ShapeFiles/GML from a WMS/WFS source please? –  JJD Jan 27 at 14:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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