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

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

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

  • 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: osmandapp/Osmand

  @Override
  public boolean accept(Geometry geometry) {
    boolean accept = true;

    if((geometry instanceof Polygon || geometry instanceof MultiPolygon)
        && geometry.getArea() < minArea) {
      accept = false;

    } else if((geometry instanceof LineString || geometry instanceof MultiLineString)
        && geometry.getLength() < minLength) {
      accept = false;
    }

    return accept;
  }
}
origin: com.vividsolutions/jts

/**
 *  Returns the area of this <code>GeometryCollection</code>
 *
 * @return the area of the polygon
 */
public double getArea()
{
 double area = 0.0;
 for (int i = 0; i < geometries.length; i++) {
  area += geometries[i].getArea();
 }
 return area;
}
origin: com.vividsolutions/jts

static double area(Collection geoms)
{
  double area = 0.0;
   for (Iterator i = geoms.iterator(); i.hasNext(); ) {
     Geometry geom = (Geometry) i.next();
     area += geom.getArea();
   }
   return area;
}
 
origin: com.vividsolutions/jts

private void checkArea()
{
  double inputArea = input.getArea();
  double resultArea = result.getArea();
  
  if (distance > 0.0
      && inputArea > resultArea) {
    isValid = false;
    errorMsg = "Area of positive buffer is smaller than input";
  errorIndicator = result;
  }
  if (distance < 0.0
      && inputArea < resultArea) {
    isValid = false;
    errorMsg = "Area of negative buffer is larger than input";
    errorIndicator = result;
  }
 report("Area");
}
 
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: opentripplanner/OpenTripPlanner

private void createNamedAreas(AreaEdgeList edgeList, Ring ring, Collection<Area> areas) {
  Polygon containingArea = ring.toJtsPolygon();
  for (Area area : areas) {
    Geometry intersection = containingArea.intersection(area.toJTSMultiPolygon());
    if (intersection.getArea() == 0) {
      continue;
    }
    NamedArea namedArea = new NamedArea();
    OSMWithTags areaEntity = area.parent;
    int cls = StreetEdge.CLASS_OTHERPATH;
    cls |= OSMFilter.getStreetClasses(areaEntity);
    namedArea.setStreetClass(cls);
    String id = "way (area) " + areaEntity.getId() + " (splitter linking)";
    I18NString name = handler.getNameForWay(areaEntity, id);
    namedArea.setName(name);
    WayProperties wayData = wayPropertySet.getDataForWay(areaEntity);
    Double safety = wayData.getSafetyFeatures().first;
    namedArea.setBicycleSafetyMultiplier(safety);
    namedArea.setOriginalEdges(intersection);
    StreetTraversalPermission permission = OSMFilter.getPermissionsForEntity(areaEntity,
        StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE);
    namedArea.setPermission(permission);
    edgeList.addArea(namedArea);
  }
}
origin: org.geotools/gt-main

static public double area(Geometry arg0)
{
   if (arg0 == null) return -1d;
   Geometry _this = arg0;
   return _this.getArea();
}
origin: org.orbisgis/h2gis

  public static Double getArea(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getArea();
  }
}
origin: org.geotools/gt2-main

static public double area(Geometry arg0)
{
   Geometry _this = arg0;
   return _this.getArea();
}
origin: org.orbisgis/h2spatial

  public static Double getArea(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getArea();
  }
}
origin: org.orbisgis/h2gis-functions

  public static Double getArea(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getArea();
  }
}
origin: com.vividsolutions/jts-example

static double area(Collection geoms)
{
  double area = 0.0;
   for (Iterator i = geoms.iterator(); i.hasNext(); ) {
     Geometry geom = (Geometry) i.next();
     area += geom.getArea();
   }
   return area;
}
 
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 double area(GeometryType geom) throws FunctionExecutionException {
  Geometry g = getGeometry(geom);
  return g.getArea();
}
origin: org.geotools/gt-jts-wrapper

public final double getArea() {
  com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
  return jtsGeom.getArea();
}
origin: org.geotools/gt2-jts-wrapper

public final double getArea() {
  com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
  return jtsGeom.getArea();
}
origin: BaseXdb/basex

 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  return Dbl.get(checkGeo(0, qc).getArea());
 }
}
origin: org.geoserver/wms

@Override
protected Double getSortAttributeValue(SimpleFeature f) {
  Geometry g = (Geometry) f.getAttribute(attribute);
  if (g instanceof MultiPoint)
    return (double) ((MultiPoint) g).getNumGeometries();
  if (g instanceof Polygon || g instanceof MultiPolygon)
    return g.getArea();
  else
    return g.getLength();
}
origin: org.geoserver/kml

@Override
protected Double getSortAttributeValue(SimpleFeature f) {
  Geometry g = (Geometry) f.getAttribute(attribute);
  if (g instanceof MultiPoint)
    return (double) ((MultiPoint) g).getNumGeometries();
  if (g instanceof Polygon || g instanceof MultiPolygon)
    return g.getArea();
  else
    return g.getLength();
}
origin: mapplus/spatial_statistics_for_geotools_udig

public double getArea(Geometry geometry, AreaUnit targetUnit) {
  double area = transformGeometry(geometry).getArea();
  if (targetUnit == AreaUnit.Default) {
    return area;
  }
  return UnitConverter.convertArea(Measure.valueOf(area, areaUnit), targetUnit);
}
com.vividsolutions.jts.geomGeometrygetArea

Javadoc

Returns the area of this Geometry. Areal Geometries have a non-zero area. They override this function to compute the area. Others return 0.0

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

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • orElseThrow (Optional)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JTextField (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