Hi there,

i just had the same error when trying to output a GeometryCollection in
JSON-outputformat with GeoServer 2.2.5.

I could find and fix the problem in the GeoServer-sourcecode. Maybe you want
to fix it in the main trunk too.

Here is the solution:

It was a just a small problem in writing the JSON-Object.

File: GeoJSONBuilder.java

Function: writeGeomCollection (line 109)

In the code when writing a GeometryCollection, first the array was created
and then the key "Geometries" was 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();
    }

 I hope that I could help you.

Best regards
Paul



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/JSON-output-through-the-WFS-fails-tp3786946p5046307.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to