[Geoserver-users] WFS query to find lowest and highest value of a attribute in a layer

Hi,

WFS does actually support that somehow. The query needs just to contain maxFeatures=1 with sortBy ascending/descending. This query returns a town with highest population in 1999 (Helsinki, 515490). You can shorten the response by including also the &propertyname parameter.

http://hip.latuviitta.org/cgi-bin/tinyows?service=wfs&version=1.1.0&request=GetFeature&typename=lv:mml_cityp&maxFeatures=1&sortBy=asulkm1999+D

This one returns a village with lowest population value (0, means missing data in this case)

http://hip.latuviitta.org/cgi-bin/tinyows?service=wfs&version=1.1.0&request=GetFeature&typename=lv:mml_cityp&maxFeatures=1&sortBy=asulkm1999+A

I wouldn’t trust that results from an unknown WFS server is right, though. I guess that sorting with different backends ant together with filters is generally very little tested. I am remembering that it worked OK for me with Geoserver and PostGIS once I was playing with this sometimes.

Corresponding Geoserver document page is http://docs.geoserver.org/stable/en/user/services/wfs/reference.html

Results comes from TinyOWS at the moment because my super cheap virtual server does not have enough memory for running Geoserver, sorry for that.

-Jukka Rahkonen-

···

Martin Davis wrote:

WFS doesn’t support aggregation in queries, only filtering. (In other words, it’s not functionally compatible with SQL).

However, you can do this by using a WPS process. Have a look at the gs:Aggregate process.

On Thu, Dec 13, 2012 at 2:02 AM, zeliofern <zelio.fern@anonymised.com> wrote:

Hi Guys

i have gone through the documentation and it is said that ogc:max and
ogc:min function is just used to get max between provided numbers. also on
ogc and arcgis website it is said to use SortBy in WFS query filter.

i have 2 question :

  1. does geoserver have support to use sortby in WFS filter query?

2)my requirement is to find the lowest and the highest value in a attribute
of layer published in geoserver
is there any WFS query function to do that?


View this message in context: http://osgeo-org.1560.n6.nabble.com/WFS-query-to-find-lowest-and-highest-value-of-a-attribute-in-a-layer-tp5022702.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only – learn more at:
http://p.sf.net/sfu/learnmore_122712


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Martin Davis

OpenGeo - http://opengeo.org

Expert service straight from the developers.