camptocamp / cgxp

22 stars 22 forks source link

getFeature-Plugin: sorting of numbers #1041

Open eleu opened 8 years ago

eleu commented 8 years ago

We have a layer called "MIV-Zählstelle" with an attribute "Anzahl Fahrstreifen". This attribute only contains numbers and is also stored as a number in the database. If I do a getFeature-request over a couple of them and sort "Anzahl Fahrstreifen", it is not recogniced as sorting numbers.

getfeature Instead of 0,1,2,4,6,7,10 it is 0,1,10,2,4,6,7.

We also tried with "gml_type" "auto", but it did not work. What can we do?

see https://github.com/camptocamp/baselstadt_mapbs/issues/67

asaunier commented 8 years ago

That's most likely because all columns in the featuresgrid are typed as "string": https://github.com/camptocamp/cgxp/blob/1.6/core/src/script/CGXP/plugins/FeaturesGrid.js#L765

Anyway not sure the WFS GetFeature responses provide types for the returned attributes. Maybe if the layer metadata gml_types is set to auto as recommended in http://docs.camptocamp.net/c2cgeoportal/1.6/administrator/mapfile.html#wfs-getfeature but on the other hand the mapserver documentation says that:

gml_types (Optional) If this field is “auto” then some input feature drivers (ie. OGR, POSTGIS, ORACLESPATIAL and native shapefiles) will automatically populate the type, width and precision metadata for the layer based on the source file. Currently this is only used for OGR based output formats, not the WFS GML2/GML3 output.

http://mapserver.org/fr/ogc/wfs_server.html