org.locationtech.jts.geom.Geometry.getEnvelope()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(413)

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

Geometry.getEnvelope介绍

[英]Gets a Geometry representing the envelope (bounding box) of this Geometry.

If this Geometry is:

  • empty, returns an empty Point.
  • a point, returns a Point.
  • a line parallel to an axis, a two-vertex LineString
  • otherwise, returns a Polygon whose vertices are (minx miny, maxx miny, maxx maxy, minx maxy, minx miny).
    [中]获取表示此Geometry的封套(边界框)的几何体。
    如果该Geometry为:
    *empty,返回一个空Point
    *一个点,返回一个Point
    *平行于轴的线,两个顶点LineString
    *否则,返回一个Polygon,其顶点为(minx miny、max miny、max maxy、minx maxy、minx miny)。

代码示例

代码示例来源:origin: geotools/geotools

public static Geometry envelope(Geometry arg0) {
  if (arg0 == null) return null;
  Geometry _this = arg0;
  return _this.getEnvelope();
}

代码示例来源:origin: geotools/geotools

public ClippingFeatureIterator(
    SimpleFeatureIterator delegate,
    Geometry clip,
    SimpleFeatureType schema,
    boolean preserveZ) {
  this.delegate = delegate;
  // can we use the fast clipper?
  if (clip.getEnvelope().equals(clip)) {
    this.clipper = new GeometryClipper(clip.getEnvelopeInternal());
  } else {
    this.clip = clip;
  }
  fb = new SimpleFeatureBuilder(schema);
  this.preserveZ = preserveZ;
}

代码示例来源:origin: geotools/geotools

return toSDOGeom((LineString) geometry, srid);
} else if (Polygon.class.isAssignableFrom(geometry.getClass())) {
  if (geometry.equalsTopo(geometry.getEnvelope())) {
    return toSDOGeom(geometry.getEnvelopeInternal(), srid);
  } else {

代码示例来源:origin: geotools/geotools

public Geometry getEnvelope() {
  return geometry.getEnvelope();
}

代码示例来源:origin: geotools/geotools

@Override
public ROI intersect(ROI roi) {
  final Geometry geom = getGeometry(roi);
  // is it a rectangle?
  if (geom != null && geom.equalsExact(geom.getEnvelope())) {
    GeometryClipper clipper = new GeometryClipper(geom.getEnvelopeInternal());
    Geometry intersect = clipper.clip(getAsGeometry(), true);
    return new ROIGeometry(intersect);
  } else {
    return super.intersect(roi);
  }
}

代码示例来源:origin: geotools/geotools

Coordinate[] coords = geometry.getEnvelope().getCoordinates();

代码示例来源:origin: geotools/geotools

@Override
public ROI intersect(ROI roi) {
  final Geometry geom = getGeometry(roi);
  // is it a rectangle?
  if (geom != null && geom.equalsExact(geom.getEnvelope())) {
    GeometryClipper clipper = new GeometryClipper(geom.getEnvelopeInternal());
    Geometry intersect = clipper.clip(getAsGeometry(), true);
    return new ROIGeometry(intersect, hints);
  } else {
    return super.intersect(roi);
  }
}

代码示例来源:origin: geotools/geotools

@DescribeProcess(
  title = "Envelope",
  description =
      "Returns the smallest bounding box polygon that contains a geometry. For a point geometry, returns the same point."
)
@DescribeResult(description = "Envelope of the input geometry")
public static Geometry envelope(
    @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) {
  return geom.getEnvelope();
}

代码示例来源:origin: geotools/geotools

final Envelope envelope = granuleFootprint.getEnvelope().getEnvelopeInternal();
double deltaMinX = Math.abs(envelope.getMinX() - granuleBBOX.getMinX());
double deltaMinY = Math.abs(envelope.getMinY() - granuleBBOX.getMinY());

代码示例来源:origin: orbisgis/h2gis

/**
   * @param geometry Geometry instance
   * @return Geometry envelope
   */
  public static Geometry getEnvelope(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getEnvelope();
  }
}

代码示例来源:origin: geotools/geotools

filterBBox(
    ReferencedEnvelope.reference(
        g1.getEnvelope().getEnvelopeInternal()),
    ft);

代码示例来源:origin: org.opengeo/geodb

@Override
protected Geometry getGeometryResult() {
  if (result != null) {
    return result.getEnvelope();
  }
  return null;
}

代码示例来源:origin: geotools/geotools

filterBBox(
    ReferencedEnvelope.reference(
        g1.getEnvelope().getEnvelopeInternal()),
    ft);

代码示例来源:origin: geotools/geotools

if (maskingBuffer > 0) {
  Geometry mappedMaskBox = mappedMask.getEnvelope();

代码示例来源:origin: geotools/geotools

public void testSimplification() throws Exception {
  SimpleFeatureSource fs = dataStore.getFeatureSource(tname("road"));
  if (fs.getSupportedHints().contains(Hints.GEOMETRY_SIMPLIFICATION) == false) return;
  SimpleFeatureCollection fColl = fs.getFeatures();
  Geometry original = null;
  try (SimpleFeatureIterator iterator = fColl.features()) {
    if (iterator.hasNext()) {
      original = (Geometry) iterator.next().getDefaultGeometry();
    }
  }
  double width = original.getEnvelope().getEnvelopeInternal().getWidth();
  Query query = new Query();
  Hints hints = new Hints(Hints.GEOMETRY_SIMPLIFICATION, width / 2);
  query.setHints(hints);
  Geometry simplified = null;
  fColl = fs.getFeatures(query);
  try (SimpleFeatureIterator iterator = fColl.features()) {
    if (iterator.hasNext()) simplified = (Geometry) iterator.next().getDefaultGeometry();
  }
  assertTrue(original.getNumPoints() >= simplified.getNumPoints());
}

代码示例来源:origin: geotools/geotools

.encode(elems[0], lf.getExpression2(), output, hints); // prop name
  Geometry g = ((Geometry) ((Literal) lf.getExpression1()).getValue()).getEnvelope();
  elems[1].getType().encode(elems[1], g, output, hints); // geom
} else {
        ((Geometry) ((Literal) lf.getExpression2()).getValue()).getEnvelope();
    elems[1].getType().encode(elems[1], g, output, hints); // geom
  } else {

代码示例来源:origin: geotools/geotools

public void testGeneralization() throws Exception {
  SimpleFeatureSource fs = dataStore.getFeatureSource(tname("lake"));
  if (fs.getSupportedHints().contains(Hints.GEOMETRY_GENERALIZATION) == false) return;
  SimpleFeatureCollection fColl = fs.getFeatures();
  Geometry original = null;
  try (SimpleFeatureIterator iterator = fColl.features()) {
    if (iterator.hasNext()) {
      original = (Geometry) iterator.next().getDefaultGeometry();
    }
  }
  double width = original.getEnvelope().getEnvelopeInternal().getWidth();
  Query query = new Query();
  Hints hints = new Hints(Hints.GEOMETRY_GENERALIZATION, width / 2);
  query.setHints(hints);
  Geometry generalized = null;
  fColl = fs.getFeatures(query);
  try (SimpleFeatureIterator iterator = fColl.features()) {
    if (iterator.hasNext()) {
      generalized = (Geometry) iterator.next().getDefaultGeometry();
    }
  }
  assertTrue(original.getNumPoints() >= generalized.getNumPoints());
}

代码示例来源:origin: jdeolive/geodb

@Override
protected void add(Geometry geometry) {
  if (result == null) {
    result = geometry;
  } else {
    if (geometry != null) {
      result = result.union(geometry.getEnvelope());
    }
  }
}

代码示例来源:origin: org.opengeo/geodb

@Override
protected void add(Geometry geometry) {
  if (result == null) {
    result = geometry;
  } else {
    if (geometry != null) {
      result = result.union(geometry.getEnvelope());
    }
  }
}

代码示例来源:origin: geotools/geotools

SimpleFeature second = iterator.next();
if (currentGeom
    .getEnvelope()
    .intersects(((Geometry) second.getDefaultGeometry()))) {

相关文章