GeoServer – How to Order Properties in GetFeatureInfo Request

geoservergetfeatureinfowms

I am attempting to transition from text/HTML to application/JSON info_format in my GetFeatureInfo requests. The issue I'm running into is that when I use a GetFeatureInfo request with a PostgreSQL view the properties are returned in alphabetical order as opposed to the ordering specified in the view. This is not the case when I use GetFeatureInfo on a table or when I use the text/HTML info_format on a PostgreSQL view.

Does anyone know a way around this?

Best Answer

That's an artefact of the way the JSON code loops over the attributes, however since you are expected to do something with the returned JSON it doesn't really matter what order it is returned in.

If it is absolutely essential to have a fixed order (i.e. you have a very dumb client) then you can write a FreeMarker template to enforce it.

Related Question