congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Geometry.buffer
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: opentripplanner/OpenTripPlanner

  private static void WriteNodesInSubGraph(Subgraph subgraph, PrintWriter islandLog, boolean hadRemoved){
    Geometry convexHullGeom = subgraph.getConvexHull();
    if (convexHullGeom != null && !(convexHullGeom instanceof Polygon)) {
      convexHullGeom = convexHullGeom.buffer(0.0001,5);
    }
    islandLog.printf("%d\t%d\t%d\t%s\t%b\n", islandCounter, subgraph.stopSize(), 
        subgraph.streetSize(), convexHullGeom, hadRemoved);
    islandCounter++;
  }
}
origin: opentripplanner/OpenTripPlanner

Geometry point = geomf.createPoint(vertexSeconds.getKey().getCoordinate());
point = JTS.transform(point, toMeters);
Geometry buffer = point.buffer(remainingMeters);
bufferLists.put(thresholdSeconds, buffer);
origin: opentripplanner/OpenTripPlanner

  geom = geom.buffer(0.01); // ~10 meters
} else if (geom instanceof Point) {
  geom = geom.buffer(0.05); // ~50 meters, so that it shows up
origin: opentripplanner/OpenTripPlanner

/**
 * The function is run periodically by the update manager.
 * The extending class should provide the getNote method. It is not implemented here
 * as the requirements for different updaters can be vastly different dependent on the data source.
 */
@Override
protected void runPolling() throws IOException{
  LOG.info("Run WFS polling updater with hashcode: {}", this.hashCode());
  notesForEdge = HashMultimap.create();
  uniqueMatchers = new HashMap<>();
  FeatureIterator<SimpleFeature> features = featureSource.getFeatures(query).features();
  while ( features.hasNext()){
    SimpleFeature feature = features.next();
    if (feature.getDefaultGeometry() == null) continue;
    Alert alert = getNote(feature);
    if (alert == null) continue;
    Geometry geom = (Geometry) feature.getDefaultGeometry();
    Geometry searchArea = geom.buffer(SEARCH_RADIUS_DEG);
    Collection<Edge> edges = graph.streetIndex.getEdgesForEnvelope(searchArea.getEnvelopeInternal());
    for(Edge edge: edges){
      if (edge instanceof StreetEdge && !searchArea.disjoint(edge.getGeometry())) {
        addNote(edge, alert, NOTE_MATCHER);
      }
    }
  }
  updaterManager.execute(new WFSGraphWriter());
}
origin: com.vividsolutions/jts

  /**
   * Creates a valid area geometry from one that possibly has bad topology
   * (i.e. self-intersections). Since buffer can handle invalid topology, but
   * always returns valid geometry, constructing a 0-width buffer "corrects"
   * the topology. Note this only works for area geometries, since buffer
   * always returns areas. This also may return empty geometries, if the input
   * has no actual area.
   * 
   * @param roughAreaGeom
   *          an area geometry possibly containing self-intersections
   * @return a valid area geometry
   */
  private Geometry createValidArea(Geometry roughAreaGeom) {
    return roughAreaGeom.buffer(0.0);
  }
}
origin: com.vividsolutions/jts

 /**
  * Creates a valid area geometry from one that possibly has
  * bad topology (i.e. self-intersections).
  * Since buffer can handle invalid topology, but always returns
  * valid geometry, constructing a 0-width buffer "corrects" the
  * topology.
  * Note this only works for area geometries, since buffer always returns
  * areas.  This also may return empty geometries, if the input
  * has no actual area.
  *
  * @param rawAreaGeom an area geometry possibly containing self-intersections
  * @return a valid area geometry
  */
 private Geometry createValidArea(Geometry rawAreaGeom)
 {
   if ( isEnsureValidTopology)
     return rawAreaGeom.buffer(0.0);
   return rawAreaGeom;
 }
}
origin: com.vividsolutions/jts

static Geometry createCircle(Coordinate centre, double radius)
{
  Geometry centrePt = geomFact.createPoint(centre);
  return centrePt.buffer(radius, POLYGON_SIZE);
}
origin: com.vividsolutions/jts

static Geometry createCircle()
{
  Geometry centrePt = geomFact.createPoint(new Coordinate(0.5, 0.5));
  return centrePt.buffer(0.5, 20);
}
 
origin: com.vividsolutions/jts

private Geometry bufferUnion(List geoms)
{
  GeometryFactory factory = ((Geometry) geoms.get(0)).getFactory();
  Geometry gColl = factory.buildGeometry(geoms);
  Geometry unionAll = gColl.buffer(0.0);
 return unionAll;
}
 
origin: com.vividsolutions/jts

public static void unionUsingBuffer(Geometry[] geom)
{
 GeometryFactory fact = geom[0].getFactory();
 Geometry geomColl = fact.createGeometryCollection(geom);
 Geometry union = geomColl.buffer(0.0);
 System.out.println(union);
}
origin: com.vividsolutions/jts

private Geometry bufferUnion(Geometry g0, Geometry g1)
{
  GeometryFactory factory = g0.getFactory();
  Geometry gColl = factory.createGeometryCollection(new Geometry[] { g0, g1 } );
  Geometry unionAll = gColl.buffer(0.0);
 return unionAll;
}
origin: com.vividsolutions/jts

/**
 * Computes the buffer a geometry,
 * using enhanced precision.
 * @param geom0 the Geometry to buffer
 * @param distance the buffer distance
 * @return the Geometry representing the buffer of the input Geometry.
 */
public Geometry buffer(Geometry geom0, double distance)
{
 Geometry geom = removeCommonBits(geom0);
 return computeResultPrecision(geom.buffer(distance));
}
origin: com.vividsolutions/jts

private Geometry bufferUnion(Geometry g0, Geometry g1)
{
  GeometryFactory factory = g0.getFactory();
  Geometry gColl = factory.createGeometryCollection(new Geometry[] { g0, g1 } );
  Geometry unionAll = gColl.buffer(0.0);
 return unionAll;
}
 
origin: com.vividsolutions/jts

private Geometry fixPolygonalTopology(Geometry geom)
{
  /**
   * If precision model was *not* changed, need to flip
   * geometry to targetPM, buffer in that model, then flip back
   */
  Geometry geomToBuffer = geom;
  if (! changePrecisionModel) {
    geomToBuffer = changePM(geom, targetPM);
  }
  
  Geometry bufGeom = geomToBuffer.buffer(0);
  
  Geometry finalGeom = bufGeom;
  if (! changePrecisionModel) {
   // a slick way to copy the geometry with the original precision factory
    finalGeom = geom.getFactory().createGeometry(bufGeom);
  }
  return finalGeom;
}
 
origin: com.vividsolutions/jts

/**
 * Snaps the vertices in the component {@link LineString}s
 * of the source geometry
 * to the vertices of the given snap geometry.
 *
 *@param snapTolerance the snapping tolerance
 *@param cleanResult whether the result should be made valid
 * @return a new snapped Geometry
 */
public Geometry snapToSelf(double snapTolerance, boolean cleanResult)
{
 Coordinate[] snapPts = extractTargetCoordinates(srcGeom);
 SnapTransformer snapTrans = new SnapTransformer(snapTolerance, snapPts, true);
 Geometry snappedGeom = snapTrans.transform(srcGeom);
 Geometry result = snappedGeom;
 if (cleanResult && result instanceof Polygonal) {
  // TODO: use better cleaning approach
  result = snappedGeom.buffer(0);
 }
 return result;
}
origin: com.vividsolutions/jts

Geometry result = geom.buffer(distance);
return result;
origin: org.geotools/gt2-main

static public Geometry buffer(Geometry arg0,double arg1)
{
   Geometry _this = arg0;
   return _this.buffer(arg1);
}
origin: org.geotools/gt-main

static public Geometry bufferWithSegments(Geometry arg0, Double arg1, Integer arg2)
{
   if (arg0 == null || arg1 == null || arg2 == null) return null;
   Geometry _this = arg0;
   return _this.buffer(arg1,arg2);
}
origin: com.vividsolutions/jts-example

static Geometry createCircle(Coordinate centre, double radius)
{
  Geometry centrePt = geomFact.createPoint(centre);
  return centrePt.buffer(radius, POLYGON_SIZE);
}
origin: com.vividsolutions/jts-example

static Geometry createCircle()
{
  Geometry centrePt = geomFact.createPoint(new Coordinate(0.5, 0.5));
  return centrePt.buffer(0.5, 20);
}
 
com.vividsolutions.jts.geomGeometrybuffer

Javadoc

Computes a buffer area around this geometry having the given width. The buffer of a Geometry is the Minkowski sum or difference of the geometry with a disc of radius abs(distance).

Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The buffer geometry is constructed using 8 segments per quadrant to approximate the circular arcs. The end cap style is CAP_ROUND.

The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty Polygon. This is also the result for the buffers of degenerate (zero-area) polygons.

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,
  • contains,
  • getArea,
  • getEnvelope,
  • intersects,
  • union,
  • apply,
  • getLength

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now