com.esri.core.geometry.Geometry.calculateArea2D()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(260)

本文整理了Java中com.esri.core.geometry.Geometry.calculateArea2D()方法的一些代码示例,展示了Geometry.calculateArea2D()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.calculateArea2D()方法的具体详情如下:
包路径:com.esri.core.geometry.Geometry
类名称:Geometry
方法名:calculateArea2D

Geometry.calculateArea2D介绍

[英]Calculates the area of the geometry. If the spatial reference is a Geographic Coordinate System (WGS84) then the 2D area calculation is defined in angular units.
[中]计算几何图形的面积。如果空间参考是地理坐标系(WGS84),则二维面积计算以角度单位定义。

代码示例

代码示例来源:origin: prestodb/presto

@Description("Returns the 2D Euclidean area of a geometry")
@ScalarFunction("ST_Area")
@SqlType(DOUBLE)
public static double stArea(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  // The Esri geometry library does not support area for geometry collections. We compute the area
  // of collections by summing the area of the individual components.
  GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType());
  if (type == GeometryType.GEOMETRY_COLLECTION) {
    double area = 0.0;
    GeometryCursor cursor = geometry.getEsriGeometryCursor();
    while (true) {
      com.esri.core.geometry.Geometry esriGeometry = cursor.next();
      if (esriGeometry == null) {
        return area;
      }
      area += esriGeometry.calculateArea2D();
    }
  }
  return geometry.getEsriGeometry().calculateArea2D();
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

public double area() {
  return getEsriGeometry().calculateArea2D();
}

代码示例来源:origin: Esri/geometry-api-java

public double area() {
  return getEsriGeometry().calculateArea2D();
}

代码示例来源:origin: Esri/geometry-api-java

public double area() {
  return getEsriGeometry().calculateArea2D();
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

public double area() {
  return getEsriGeometry().calculateArea2D();
}

代码示例来源:origin: apache/asterixdb

@Override
protected Object evaluateOGCGeometry(OGCGeometry geometry) throws HyracksDataException {
  double area;
  if (!"GeometryCollection".equals(geometry.geometryType())) {
    area = geometry.getEsriGeometry().calculateArea2D();
  } else {
    GeometryCursor cursor = geometry.getEsriGeometryCursor();
    Geometry geometry1 = cursor.next();
    area = 0;
    while (geometry1 != null) {
      area += geometry1.calculateArea2D();
      geometry1 = cursor.next();
    }
  }
  return area;
}

代码示例来源:origin: aseldawy/pigeon

@Override
public Double exec(Tuple input) throws IOException {
 OGCGeometry geom = null;
 try {
  Object v = input.get(0);
  geom = geometryParser.parseGeom(v);
  return geom.getEsriGeometry().calculateArea2D();
 } catch (ExecException ee) {
  throw new GeoException(geom, ee);
 }
}

代码示例来源:origin: prestosql/presto

@Description("Returns the 2D Euclidean area of a geometry")
@ScalarFunction("ST_Area")
@SqlType(DOUBLE)
public static double stArea(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  // The Esri geometry library does not support area for geometry collections. We compute the area
  // of collections by summing the area of the individual components.
  GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType());
  if (type == GeometryType.GEOMETRY_COLLECTION) {
    double area = 0.0;
    GeometryCursor cursor = geometry.getEsriGeometryCursor();
    while (true) {
      com.esri.core.geometry.Geometry esriGeometry = cursor.next();
      if (esriGeometry == null) {
        return area;
      }
      area += esriGeometry.calculateArea2D();
    }
  }
  return geometry.getEsriGeometry().calculateArea2D();
}

代码示例来源:origin: Esri/spatial-framework-for-hadoop

public DoubleWritable evaluate(BytesWritable geomref) {
    if (geomref == null || geomref.getLength() == 0) {
      LogUtils.Log_ArgumentsNull(LOG);
      return null;
    }

    OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
    if (ogcGeometry == null){
      LogUtils.Log_ArgumentsNull(LOG);
      return null;
    }

    resultDouble.set(ogcGeometry.getEsriGeometry().calculateArea2D());
    return resultDouble;
  }
}

代码示例来源:origin: com.facebook.presto/presto-geospatial

@Description("Returns the 2D Euclidean area of a geometry")
@ScalarFunction("ST_Area")
@SqlType(DOUBLE)
public static double stArea(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  // The Esri geometry library does not support area for geometry collections. We compute the area
  // of collections by summing the area of the individual components.
  GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType());
  if (type == GeometryType.GEOMETRY_COLLECTION) {
    double area = 0.0;
    GeometryCursor cursor = geometry.getEsriGeometryCursor();
    while (true) {
      com.esri.core.geometry.Geometry esriGeometry = cursor.next();
      if (esriGeometry == null) {
        return area;
      }
      area += esriGeometry.calculateArea2D();
    }
  }
  return geometry.getEsriGeometry().calculateArea2D();
}

代码示例来源:origin: Esri/geometry-api-java

static boolean hasNonEmptyBoundary(Geometry geom,
    ProgressTracker progress_tracker) {
  if (geom.isEmpty())
    return false;
  Geometry.Type gt = geom.getType();
  if (gt == Geometry.Type.Polygon) {
    if (geom.calculateArea2D() == 0)
      return false;
    return true;
  } else if (gt == Geometry.Type.Polyline) {
    boolean[] b = new boolean[1];
    b[0] = false;
    calculatePolylineBoundary_(geom._getImpl(), progress_tracker, true,
        b);
    return b[0];
  } else if (gt == Geometry.Type.Envelope) {
    return true;
  } else if (Geometry.isSegment(gt.value())) {
    if (!((Segment) geom).isClosed()) {
      return true;
    }
    return false;
  } else if (Geometry.isPoint(gt.value())) {
    return false;
  }
  return false;
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

static boolean hasNonEmptyBoundary(Geometry geom,
    ProgressTracker progress_tracker) {
  if (geom.isEmpty())
    return false;
  Geometry.Type gt = geom.getType();
  if (gt == Geometry.Type.Polygon) {
    if (geom.calculateArea2D() == 0)
      return false;
    return true;
  } else if (gt == Geometry.Type.Polyline) {
    boolean[] b = new boolean[1];
    b[0] = false;
    calculatePolylineBoundary_(geom._getImpl(), progress_tracker, true,
        b);
    return b[0];
  } else if (gt == Geometry.Type.Envelope) {
    return true;
  } else if (Geometry.isSegment(gt.value())) {
    if (!((Segment) geom).isClosed()) {
      return true;
    }
    return false;
  } else if (Geometry.isPoint(gt.value())) {
    return false;
  }
  return false;
}

相关文章