10-18-2016 02:24 AM - last edited on 10-25-2016 02:55 AM by jan.neumann
I was wondering if it is possible to order results of a search returned by WFS-G(s) in Geospatial Portal?
Maybe there is a hidden parameter I could use or an event I could listen to?
Thank you in advance.
10-25-2016 02:55 AM
I've tested WebMap's WFS and it is able to sort the results if you provide another parameter called sortBy. However this parameter does not work for WebMap's WFS-G. If it would then you have to:
<ows:Operation name="GetFeature"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://188.8.131.52/WFSG-Moscow/service.svc/get?sortBy=mySortAttribute"/> ...
This would work for plain WFS. But WFS-G seems to be limited.
11-03-2016 06:46 PM
For whatever reason, the WFSG does not implement sorting at all.
One possible solution service-side would be to either proxy over the WFSG and have some logic in place to manipulate the result GML by some criteria. This could also be a custom pipe plugged into the WFSG pipechain directly
I also wonder if it could be done by having the WFSG to use a DB view as its source feature class and have the view declare an ORDER BY clause.
11-04-2016 01:45 AM
Lukasz, the DB view sounds as the simplest and elegant. But are we sure that WebMap does not use "SORT BY <ID>" already?
11-04-2016 06:00 AM
Using an ORDER BY statement in the database View does order the results of the WFS-G so this is technically an option.
However, the customer's dataset is a 30 million row address dataset so they've raised concerns about performance having an ORDER BY statement in the View.
I will mark @lukasz.baraniak's post as a solution.
11-04-2016 06:03 AM
You are right but you will get the performance hit anyway when expecting sorting the data in other way than the database's default.
11-04-2016 06:06 AM
Yes but the customer's opinion is our application should be performing the sort of the results from querying the View as that should be a smaller amount of rows to sort versus getting the database to sort all 30 million rows first.
11-04-2016 09:50 AM
I might be off here, but considering that all goes well and WFSG actually applies the filtering criteria down on the feature class instead of filtering them client-side, won't the order by clause mandated by the view be in fact merged with the where clause? I was told Oracle views work exactly this way. So... sorting after filtering instead of the other way around.