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 there a way to programmatically change the geometry column on which a WFS layer is based and displayed?

WFS (from GeoServer) is correctly returning me two geometry columns, I want to change "on the fly" the geometry column openLayers uses to display items, obviously having openLayers displaying items (points, in this case) at the new coordinates.

I already tried to change the protocol.geometryName field, even forcing reload o refresh on the layer, but without success.

Thanks in advance

share|improve this question
    
could you post a code snippet?. Also two geometry column means you are having two geom types in single layer?. –  rashad Sep 27 '13 at 7:32

2 Answers 2

Changing the geometryName property won't have any effect, because the geometry field is defined in the geoServer layer.

Create two views which expose each geometry column:

See here for an example.

Then create layers in geoserver on each view.

You can then programmatically change the source layer name in your WFS layer source and call refresh().

share|improve this answer

Why do you want to do this? Are they in two different projections?

May be easier to use WMS rather than WFS

Create two WMS layers, using one geometry in each layer only, then just pick a layer client side and disable the other one. (Toggle between them)

The client will only pick from the layer it sees for WFS requests, for hover, etc.

Cheers

Mark

share|improve this answer

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.