Examples of GeometryCollection


Examples of com.vividsolutions.jts.geom.GeometryCollection

        // Handle union
        if (unionResults) {
          GeometryFactory geoFactory = new GeometryFactory();
          Geometry[] geos = new Geometry[resultGeometries.size()];
          resultGeometries.toArray(geos);
          GeometryCollection geoCollection = geoFactory
              .createGeometryCollection(geos);
          resultGeometries = new ArrayList<Geometry>();
          resultGeometries.add(geoCollection.union());
        }
      }

      // Various out format
      if ("json".equals(f)) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

 
  @Override
  public void write(Object[] input){
    logger.debug("writing "+this.fileName+" ...");
    Geometry[] geometries = (Geometry[])input;
    GeometryCollection coll = new GeometryCollection(geometries, new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING),4030));
   
    //write geometries
    try{
      shpWriter.skipHeaders();
      shpWriter.write(coll,ShapeType.POLYGON);
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

        ArrayList<Point> pList = new ArrayList<>(commands.size());
        for (GCodeCommand c : commands) {
            if(c.type == GCodeCommand.Type.MOVE)
                pList.add(JTSUtils.createPoint2D(c.x, c.y));
        }
        GeometryCollection g = new GeometryCollection(pList.toArray(new Point[pList.size()]), JTSUtils.getFactory());
        return g.convexHull();
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

            if(s != null){
                polys[i] = JTSUtils.createMultiPolygon(s);
            }
        }
       
        GeometryCollection gc;
        gc = JTSUtils.getFactory().createGeometryCollection(polys);
       
        Geometry union = gc.buffer(0);
        return JTSUtils.toShape(union);
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

                        geomsArray = new Geometry[walkShedEdges.size()];
                        int k = 0;
                        for (LineString ls : walkShedEdges.values())
                            geomsArray[k++] = ls;
                    } // end if-else: maxTime condition
                    GeometryCollection gc = gf.createGeometryCollection(geomsArray);
                    // create the concave hull, but in case it fails we just return the convex hull
                    Geometry outputHull = null;
                    LOG.debug(
                            "create concave hull from {} geoms with edge length limit of about {} m (distance on meridian)",
                            geomsArray.length, concaveHullAlpha * 111132);
                    // 1deg at Latitude phi = 45deg is about 111.132km
                    // (see wikipedia: http://en.wikipedia.org/wiki/Latitude#The_length_of_a_degree_of_latitude)
                    try {
                        ConcaveHull hull = new ConcaveHull(gc, concaveHullAlpha);
                        outputHull = hull.getConcaveHull();
                    } catch (Exception e) {
                        outputHull = gc.convexHull();
                        LOG.debug("Could not generate ConcaveHull for WalkShed, using ConvexHull instead.");
                    }
                    LOG.debug("write shed geom");
                    geometryJSON.write(outputHull, sw);
                    LOG.debug("done");
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

      Coordinate[] c = new Coordinate[] { coord[i] };
      CoordinateArraySequence cs = new CoordinateArraySequence(c);
      geometries[i] = new Point(cs, geom.getFactory());
    }
   
    return new GeometryCollection(geometries, geom.getFactory());
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

      Coordinate[] c = new Coordinate[] { coord[i] };
      CoordinateArraySequence cs = new CoordinateArraySequence(c);
      geometries[i] = new Point(cs, gc.getFactory());
    }
   
    return new GeometryCollection(geometries, gc.getFactory());
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

import com.vividsolutions.jts.simplify.DouglasPeuckerSimplifier;

public class GraphUtils {

    public static Geometry makeConcaveHull(Graph graph) {
        GeometryCollection geometries = geometryCollectionFromVertices(graph);
        ConcaveHull hull = new ConcaveHull(geometries, 0.01);
        return hull.getConcaveHull();
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

        int i = 0;
        for (Vertex v : vertices) {
            points[i++] = gf.createPoint(v.getCoordinate());
        }

        GeometryCollection geometries = new GeometryCollection(points, gf);
        return geometries;
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

        Geometry u = geometryFactory.createMultiPolygon(allRings.toArray(new Polygon[allRings
                .size()]));
        u = u.union();

        if (u instanceof GeometryCollection) {
            GeometryCollection mp = (GeometryCollection) u;
            for (int i = 0; i < mp.getNumGeometries(); ++i) {
                Geometry poly = mp.getGeometryN(i);
                if (!(poly instanceof Polygon)) {
                    LOG.warn("Unexpected non-polygon when merging areas: " + poly);
                    continue;
                }
                outermostRings.add(toRing((Polygon) poly, nodeMap));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.