code: private void write(GeometryCollection coll, JsonGenerator gen) throws IOException {
          gen.writeStringField("type", "GeometryCollection");
          gen.writeArrayFieldStart("geometries");
          for (int i = 0; i < coll.getNumGeometries(); ++i) {
              Geometry geom = coll.getGeometryN(i);
              gen.writeStartObject();
              if (geom instanceof Point) {
                  write((Point) geom, gen);
              } else if (geom instanceof MultiPoint) {
                  write((MultiPoint) geom, gen);
              } else if (geom instanceof LineString) {
                  write((LineString) geom, gen);
              } else if (geom instanceof MultiLineString) {
                  write((MultiLineString) geom, gen);
              } else if (geom instanceof Polygon) {
                  write((Polygon) geom, gen);
              } else if (geom instanceof MultiPolygon) {
                  write((MultiPolygon) geom, gen);
              } else if (geom instanceof GeometryCollection) {
                  write((GeometryCollection) geom, gen);
              } else {
                  throw new RuntimeException("Unsupported Geomery type");
              }
               gen.writeEndObject();
          }
          gen.writeEndArray();
      }
docs: Each element in the geometries array of a GeometryCollection is one of
  the geometry objects described above:
  
  { "type": "GeometryCollection", "geometries": [ { "type": "Point",
  "coordinates": [100.0, 0.0] }, { "type": "LineString", "coordinates": [
  [101.0, 0.0], [102.0, 1.0] ] } ] }
  
  @param coll
  @param gen
  @throws IOException