GeoServer 2.3 does not return an empty XML node for columns with null values. For example, this is a snippet taken from a WFS response to a CQL query:

<gml:featureMember>
<ems:airports fid="airports.3822">
<ems:IKO>KINL</ems:IKO>
<ems:na3>US24271</ems:na3>
<ems:Name>FALLS INTL</ems:Name>
<ems:Type>Civilian/Public</ems:Type>
<ems:the_geom>...</ems:the_geom>
<ems:Mod_time>2011-09-02T20:17:30.831</ems:Mod_time>
</ems:airports>
</gml:featureMember>
<gml:featureMember>
<ems:airports fid="airports.10117">
<ems:IKO>CKV3</ems:IKO>
<ems:Name>DRYDEN BEST WESTERN (Heli)</ems:Name>
<ems:the_geom>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">-92.833333,49.783333</gml:coordinates>
</gml:Point>
</ems:the_geom>
<ems:Mod_time>2011-09-08T16:56:07.334</ems:Mod_time>
<ems:Country>Canada</ems:Country>
<ems:Operator>Best Western Motor Inn</ems:Operator>
<ems:Contact>807-223-3201</ems:Contact>
</ems:airports>
</gml:featureMember>

The second featureMember element is missing the na3 and Type nodes because these are null in the database.

Is there a way to configure GeoServer to return an empty node when it encounters a column with a null value?

有帮助吗?

解决方案

Apparently this is by design, as it's a WFS specification. See the relevant discussion:

http://osgeo-org.1560.x6.nabble.com/Why-the-WFS-does-not-return-the-NULL-value-field-td3802398.html

It is suggested in that thread to instead parse the "DescribeFeatureType" response, which does contain all fields.

Now if only there was an OpenLayers Control/Plugin that combined this behavior, I would be happy, but I think I'll be forced to develop it from scratch.

其他提示

describefeaturetype only returns the columns names. Still, if one column contains null, it does not appear in the response, even if for some rows it does have a value.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top