[Geoserver-devel] [jira] (GEOS-5770) JSON-GeometryCollection-Bug

Paul Biskup created BugGEOS-5770
JSON-GeometryCollection-Bug

Issue Type:

BugBug

Assignee:

Andrea Aime

Created:

15/Apr/13 3:35 AM

Description:

There is a bug in GeoServer when working with GeometryCollections and JSON-output-format in a WFS-GetFeature-request.

see related post in Mailing List:

http://osgeo-org.1560.x6.nabble.com/JSON-output-through-the-WFS-fails-td3786946.html

I could find and fix the problem in my local GeoServer-sourcecode.

Here is the solution:

It is a just a small problem when writing the JSON-Object.

File: GeoJSONBuilder.java

Function: writeGeomCollection (line 109)

In the code when writing a GeometryCollection, first the array gets created and then the key “Geometries” gets written. You have to switch the two lines, and the JSON-Output for GeometryCollection will work fine.

private JSONBuilder writeGeomCollection(GeometryCollection collection) {
//IMPORTANT geometries-key must be written before creating array
this.key(“geometries”);
this.array();

for (int i = 0, n = collection.getNumGeometries(); i < n; i++)

{ writeGeom(collection.getGeometryN(i)); }

return this.endArray();
}

Project:

GeoServer

Priority:

MajorMajor

Reporter:

Paul Biskup

This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: [http://www.atlassian.com/software/jira](http://www.atlassian.com/software/jira)