On Fri, Apr 12, 2013 at 9:45 AM, PBI <paul.bis...@fit.fichtner.de> wrote:

> 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.
>

Interesting, can you open a bug report on jira.codehaus.org with those
details?

Cheers
Andrea

-- 
==
GeoServer training in Milan, 6th & 7th June 2013!  Visit
http://geoserver.geo-solutions.it for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
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