Codota Logo
Geometry.union
Code IndexAdd Codota to your IDE (free)

How to use
union
method
in
com.vividsolutions.jts.geom.Geometry

Best Java code snippets using com.vividsolutions.jts.geom.Geometry.union (Showing top 20 results out of 342)

  • Common ways to obtain Geometry
private void myMethod () {
Geometry g =
  • Codota IconGeometryCollection gc;gc.getGeometryN(n)
  • Codota IconSimpleFeature feature;(Geometry) feature.getDefaultGeometry()
  • Codota IconString wellKnownText;new WKTReader().read(wellKnownText)
  • Smart code suggestions by Codota
}
origin: opentripplanner/OpenTripPlanner

public void findHull() {
  LOG.info("finding hull of graph...");
  LOG.debug("using only stops? {}", useOnlyStops);
  if (bufferMeters < prototypeRoutingRequest.maxWalkDistance)
    LOG.warn("geographic filter buffer is smaller than max walk distance, this will probably yield incorrect results.");
  Graph graph= graphService.getRouter(prototypeRoutingRequest.routerId).graph;
  List<Geometry> geometries = new ArrayList<Geometry>();
  for (Vertex v : graph.getVertices()) {
    if (useOnlyStops && ! (v instanceof TransitStop))
      continue;
    Point pt = gf.createPoint(v.getCoordinate());
    Geometry geom = crudeProjectedBuffer(pt, bufferMeters);
    geometries.add(geom);
  }
  Geometry multiGeom = gf.buildGeometry(geometries);
  LOG.info("unioning hull...");
  hull = multiGeom.union();
  LOG.trace("hull is {}", hull.toText());
  // may lead to false rejections
  // DouglasPeuckerSimplifier simplifier = new DouglasPeuckerSimplifier();
}

origin: opentripplanner/OpenTripPlanner

Geometry u = geometryFactory.createMultiPolygon(allRings.toArray(new Polygon[allRings
    .size()]));
u = u.union();
origin: opentripplanner/OpenTripPlanner

Collection<Geometry> buffers = bufferLists.get(threshold);
geom = geom.union(); // combine all individual buffers in this contour into one
if ( ! resultsProjected) geom = JTS.transform(geom, fromMeters);
contours.put(threshold, geom);
origin: com.vividsolutions/jts

/**
 * Computes the union of two geometries, 
 * either of both of which may be null.
 * 
 * @param g0 a Geometry
 * @param g1 a Geometry
 * @return the union of the input(s)
 * or null if both inputs are null
 */
private Geometry unionWithNull(Geometry g0, Geometry g1)
{
  if (g0 == null && g1 == null)
    return null;
  if (g1 == null)
    return g0;
  if (g0 == null)
    return g1;
  
  return g0.union(g1);
}
origin: com.vividsolutions/jts

private Geometry repeatedUnion(List geoms)
{
  Geometry union = null;
  for (Iterator i = geoms.iterator(); i.hasNext(); ) {
    Geometry g = (Geometry) i.next();
    if (union == null)
      union = (Geometry) g.clone();
    else
      union = union.union(g);
  }
  return union;
}
 
origin: com.vividsolutions/jts

/**
 * Encapsulates the actual unioning of two polygonal geometries.
 * 
 * @param g0
 * @param g1
 * @return
 */
private Geometry unionActual(Geometry g0, Geometry g1)
{
  /*
  System.out.println(g0.getNumGeometries() + ", " + g1.getNumGeometries());
    if (g0.getNumGeometries() > 5) {
    System.out.println(g0);
    System.out.println(g1);
  }
  */
  
  //return bufferUnion(g0, g1);
  return restrictToPolygons(g0.union(g1));
}
 
origin: com.vividsolutions/jts

/**
 * Computes the set-theoretic union of two {@link Geometry}s, using enhanced precision.
 * @param geom0 the first Geometry
 * @param geom1 the second Geometry
 * @return the Geometry representing the set-theoretic union of the input Geometries.
 */
public Geometry union(Geometry geom0, Geometry geom1)
{
 Geometry[] geom = removeCommonBits(geom0, geom1);
 return computeResultPrecision(geom[0].union(geom[1]));
}
origin: com.vividsolutions/jts

public double measure(Geometry g1, Geometry g2)
{        
  double areaInt = g1.intersection(g2).getArea();
  double areaUnion = g1.union(g2).getArea();
  return areaInt / areaUnion;
}
 
origin: com.vividsolutions/jts

Geometry result = geom0.union(geom1);
return result;
origin: com.vividsolutions/jts

Geometry union = int0.union(int1);
origin: org.orbisgis/h2gis

/**
 * @param a Geometry instance.
 * @param b Geometry instance
 * @return union of Geometries a and b
 */
public static Geometry union(Geometry a,Geometry b) {
  if(a==null || b==null) {
    return null;
  }
  return a.union(b);
}
origin: org.geotools/gt-main

static public Geometry union(Geometry arg0,Geometry arg1)
{
   if (arg0 == null || arg1 == null) return null;
   Geometry _this = arg0;
   return _this.union(arg1);
}
origin: org.geotools/gt2-main

static public Geometry union(Geometry arg0,Geometry arg1)
{
   Geometry _this = arg0;
   return _this.union(arg1);
}
origin: org.orbisgis/h2spatial

/**
 * @param a Geometry instance.
 * @param b Geometry instance
 * @return union of Geometries a and b
 */
public static Geometry union(Geometry a,Geometry b) {
  if(a==null || b==null) {
    return null;
  }
  return a.union(b);
}
origin: org.orbisgis/h2gis-functions

/**
 * @param a Geometry instance.
 * @param b Geometry instance
 * @return union of Geometries a and b
 */
public static Geometry union(Geometry a,Geometry b) {
  if(a==null || b==null) {
    return null;
  }
  return a.union(b);
}
origin: com.vividsolutions/jts-core

private Geometry repeatedUnion(List geoms)
{
  Geometry union = null;
  for (Iterator i = geoms.iterator(); i.hasNext(); ) {
    Geometry g = (Geometry) i.next();
    if (union == null)
      union = (Geometry) g.clone();
    else
      union = union.union(g);
  }
  return union;
}
 
origin: BaseXdb/basex

 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  return toElement(checkGeo(0, qc).union(checkGeo(1, qc)), qc);
 }
}
origin: com.vividsolutions/jts-core

public double measure(Geometry g1, Geometry g2)
{        
  double areaInt = g1.intersection(g2).getArea();
  double areaUnion = g1.union(g2).getArea();
  return areaInt / areaUnion;
}
 
origin: org.jboss.teiid/teiid-engine

public static GeometryType union(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return getGeometryType(g1.union(g2));
}

origin: org.teiid/teiid-engine

public static GeometryType union(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return getGeometryType(g1.union(g2), geom1.getSrid());
}

com.vividsolutions.jts.geomGeometryunion

Javadoc

Computes the union of all the elements of this geometry.

union() supports GeometryCollections (which the other overlay operations currently do not).

The result obeys the following contract:

  • Unioning a set of LineStrings has the effect of fully noding and dissolving the linework.
  • Unioning a set of Polygons will always return a Polygonal geometry (unlike #union(Geometry), which may return geometrys of lower dimension if a topology collapse occurred.

Popular methods of Geometry

  • getEnvelopeInternal
    Gets an Envelope containing the minimum and maximum x and y values in this Geometry. If the geometr
  • getCoordinates
    Returns an array containing the values of all the vertices for this geometry. If the geometry is a c
  • isEmpty
    Tests whether the set of points covered by this Geometry is empty.
  • getCentroid
    Computes the centroid of this Geometry. The centroid is equal to the centroid of the set of componen
  • getGeometryN
    Returns an element Geometry from a GeometryCollection(or this, if the geometry is not a collection).
  • toText
    Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text
  • getNumGeometries
    Returns the number of Geometrys in a GeometryCollection(or 1, if the geometry is not a collection).
  • getFactory
    Gets the factory which contains the context in which this geometry was created.
  • getGeometryType
    Returns the name of this Geometry's actual class.
  • getSRID
    Returns the ID of the Spatial Reference System used by the Geometry. JTS supports Spatial Reference
  • getCoordinate
    Returns a vertex of this Geometry (usually, but not necessarily, the first one). The returned coordi
  • intersection
    Computes a Geometry representing the point-set which is common to both this Geometry and the other
  • getCoordinate,
  • intersection,
  • buffer,
  • contains,
  • getArea,
  • getEnvelope,
  • intersects,
  • apply,
  • getLength

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Path (java.nio.file)
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JCheckBox (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now