0

I'm using WFS with multiple layers, but the results are sorted by layer, not by the full result set.

For instance:

Layer A

  • a
  • b
  • c
  • d

Layer B

  • a
  • b
  • c
  • d

I want the results be a single list sorted by name (all layers have the attribute "name"), no matter from which layer the result is, I just need a global order.

Layers result

  • a
  • b
  • c
  • d
  • e
  • etc...

Here is my example query:

http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&outputFormat=application/json&srsName=EPSG:4326&request=GetFeature&count=10&startIndex=0&typeNames=(myworkspace:layerA)(myworkspace:layerB)&propertyName=myworkspace:layerA:name,myworkspace:layerA:geom,myworkspace:layerB:name,myworkspace:layerB:geom,&cql_filter=(name ILIKE '%example%25');(name ILIKE '%example%25')&sortBy=name

What would be a good sortBy syntax?

5
  • 3
    I do not believe that WFS has any support for what you try to do, that is, to union two featuretypes on the fly. If there is such support it should be found from the the standard docs.opengeospatial.org/is/09-025r2/09-025r2.html
    – user30184
    Feb 12 at 11:54
  • Your example is not at all clear. No e is mentioned in the before results, but is found in the after. And why isn't it a a b b c c d d?
    – Vince
    Feb 12 at 12:39
  • thank you for your answer. Yes your are right, forget about "e", it's just a bad example. "a a b b c c d d" is what I expect to receive from the call. I mean, a unique list sorted, and not sorted only at layer level. That is what an end-user expect as a normal search results. Any idea how to achieve the sorting in Geoserver layers?
    – dpalmeira
    Feb 12 at 16:11
  • 1
    Then the client will need to reorder the results, or you can create a view that combines the 2 tables and publish that view as a layer.
    – Ian Turton
    Feb 12 at 17:33
  • Thank you so much for your answer, I will explore the second option first.
    – dpalmeira
    Feb 12 at 17:59

0

Your Answer

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

Browse other questions tagged or ask your own question.