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

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

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

Geometry.calculateLength2D介绍

[英]Calculates the length of the geometry. If the spatial reference is a Geographic Coordinate System (a system where coordinates are defined using angular units such as longitude and latitude) then the 2D distance calculation is returned in angular units. In cases where length must be calculated on a Geographic Coordinate System consider the using the geodeticLength method on the GeometryEngine
[中]计算几何图形的长度。如果空间参照是地理坐标系(使用角度单位(如经度和纬度)定义坐标的系统),则以角度单位返回二维距离计算。在必须在地理坐标系上计算长度的情况下,考虑在几何引擎上使用大地测量长度法。

代码示例

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

@Description("Returns the length of a LineString or Multi-LineString using Euclidean measurement on a 2D plane (based on spatial ref) in projected units")
@ScalarFunction("ST_Length")
@SqlType(DOUBLE)
public static double stLength(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  validateType("ST_Length", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING));
  return geometry.getEsriGeometry().calculateLength2D();
}

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

public double length() {
    return getEsriGeometry().calculateLength2D();
  }
}

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

public double length() {
    return getEsriGeometry().calculateLength2D();
  }
}

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

@Override
protected Object evaluateOGCGeometry(OGCGeometry geometry) throws HyracksDataException {
  if (geometry instanceof OGCLineString) {
    return geometry.getEsriGeometry().calculateLength2D();
  } else if (geometry instanceof OGCMultiLineString) {
    GeometryCursor cursor = geometry.getEsriGeometryCursor();
    double length = 0;
    Geometry geometry1 = cursor.next();
    while (geometry1 != null) {
      length += geometry1.calculateLength2D();
      geometry1 = cursor.next();
    }
    return length;
  } else {
    throw new UnsupportedOperationException(
        "The operation " + getIdentifier() + " is not supported for the type " + geometry.geometryType());
  }
}

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

@Description("Returns the length of a LineString or Multi-LineString using Euclidean measurement on a 2D plane (based on spatial ref) in projected units")
@ScalarFunction("ST_Length")
@SqlType(DOUBLE)
public static double stLength(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  validateType("ST_Length", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING));
  return geometry.getEsriGeometry().calculateLength2D();
}

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

@Description("Returns the length of a LineString or Multi-LineString using Euclidean measurement on a 2D plane (based on spatial ref) in projected units")
@ScalarFunction("ST_Length")
@SqlType(DOUBLE)
public static double stLength(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  OGCGeometry geometry = deserialize(input);
  validateType("ST_Length", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING));
  return geometry.getEsriGeometry().calculateLength2D();
}

代码示例来源: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().calculateLength2D());
    return resultDouble;
  }
}

相关文章