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

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

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

Geometry.toString介绍

暂无

代码示例

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

object = transformer.transform(geometry);
} catch (TransformException e) {
  String msg = "Error occured transforming " + geometry.toString();
  throw (IOException) new IOException(msg).initCause(e);

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

public static String toWKT(Geometry arg0) {
  if (arg0 == null) return null;
  Geometry _this = arg0;
  return _this.toString();
}

代码示例来源:origin: locationtech/spatial4j

@Override
public String toString() {
 return geom.toString();
}

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

public String toString() {
  return geometry.toString();
}

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

/**
 * Gets geometry.
 *
 * @param geometry The geometry from the filter.
 * @throws IllegalFilterException If there are problems creating expression.
 */
public void geometry(Geometry geometry) throws IllegalFilterException {
  // Sets the geometry for the expression, as appropriate
  LOGGER.finer("got geometry: " + geometry.toString());
  // if(curExprssn.getType()==ExpressionDefault.LITERAL_GEOMETRY){
  // LOGGER.finer("got geometry: ");
  curExprssn = new LiteralExpressionImpl();
  ((LiteralExpressionImpl) curExprssn).setValue(geometry);
  LOGGER.finer("set expression: " + curExprssn.toString());
  currentState = "complete";
  LOGGER.finer("set current state: " + currentState);
  //        }
}

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

SimpleFeature reproject(SimpleFeature feature) throws IOException {
  List<Object> attributes = feature.getAttributes();
  for (int i = 0; i < attributes.size(); i++) {
    Object object = attributes.get(i);
    if (object instanceof Geometry) {
      // do the transformation
      Geometry geometry = (Geometry) object;
      try {
        attributes.set(i, tx.transform(geometry));
      } catch (TransformException e) {
        String msg = "Error occured transforming " + geometry.toString();
        throw (IOException) new IOException(msg).initCause(e);
      }
    }
  }
  try {
    return SimpleFeatureBuilder.build(schema, attributes, feature.getID());
  } catch (IllegalAttributeException e) {
    String msg = "Error creating reprojeced feature";
    throw (IOException) new IOException(msg).initCause(e);
  }
}

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

SimpleFeature reproject(SimpleFeature feature) throws IOException {

    List<Object> attributes = feature.getAttributes();

    for (int i = 0; i < attributes.size(); i++) {
      Object object = attributes.get(i);
      if (object instanceof Geometry) {
        // do the transformation
        Geometry geometry = (Geometry) object;
        try {
          attributes.set(i, tx.transform(geometry));
        } catch (TransformException e) {
          String msg = "Error occured transforming " + geometry.toString();
          throw (IOException) new IOException(msg).initCause(e);
        }
      }
    }

    try {
      return SimpleFeatureBuilder.build(schema, attributes, feature.getID());
    } catch (IllegalAttributeException e) {
      String msg = "Error creating reprojeced feature";
      throw (IOException) new IOException(msg).initCause(e);
    }
  }
}

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

/**
 * Recieves a geometry from its child filter.
 *
 * @param geometry The geometry from the filter.
 * @throws RuntimeException if the filterFactory can't handle the geometry
 * @task REVISIT: can we throw another exception?
 */
public void geometry(Geometry geometry) throws RuntimeException {
  // Sends the geometry to the expression
  try {
    LOGGER.finer("got geometry: " + geometry);
    expressionFactory.geometry(geometry);
    if (expressionFactory.isReady()) {
      LOGGER.finer("expression factory made expression and sent " + "to filter factory");
      filterFactory.expression(expressionFactory.create());
    }
  } catch (IllegalFilterException ife) {
    LOGGER.finer("Had problems adding geometry: " + geometry.toString());
    throw new RuntimeException("problem adding geometry to filter ", ife);
  }
}

代码示例来源:origin: locationtech/jts

public String toString()
 {
   return baseGeom.toString();
 }
}

代码示例来源:origin: locationtech/geowave

@Override
 public String toString() {
  return "DBScanClusterList [clusterGeo="
    + (clusterGeo == null ? "null" : clusterGeo.toString())
    + ", id="
    + id
    + "]";
 }
}

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

public String toString() {
  return this.geom.toString();
}

代码示例来源:origin: postgis/postgis-java

public String toString() {
  return geom.toString();
}

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

@Override
  public void encode(Geometry geometry, AttributesImpl atts, GMLWriter handler) throws Exception {
    if (geometry instanceof LineString) {
      LineStringEncoder lineString =
          new LineStringEncoder(encoder, LineStringEncoder.LINE_STRING);
      lineString.encode((LineString) geometry, atts, handler);
    } else if (geometry instanceof Point) {
      PointEncoder pt = new PointEncoder(encoder, gmlPrefix == null ? "gml" : gmlPrefix);
      pt.encode((Point) geometry, atts, handler);
    } else if (geometry instanceof Polygon) {
      PolygonEncoder polygon = new PolygonEncoder(encoder, gmlPrefix);
      polygon.encode((Polygon) geometry, atts, handler);
    } else if (geometry instanceof MultiLineString) {
      MultiLineStringEncoder multiLineString = new MultiLineStringEncoder(encoder, gmlPrefix);
      multiLineString.encode((MultiLineString) geometry, atts, handler);
    } else if (geometry instanceof MultiPoint) {
      MultiPointEncoder multiPoint = new MultiPointEncoder(encoder, gmlPrefix);
      multiPoint.encode((MultiPoint) geometry, atts, handler);
    } else if (geometry instanceof MultiPolygon) {
      MultiPolygonEncoder multiPolygon = new MultiPolygonEncoder(encoder, gmlPrefix);
      multiPolygon.encode((MultiPolygon) geometry, atts, handler);
    } else if (geometry instanceof LinearRing) {
      LinearRingEncoder linearRing = new LinearRingEncoder(encoder, gmlPrefix);
      linearRing.encode((LinearRing) geometry, atts, handler);
    } else {
      throw new Exception("Unsupported geometry " + geometry.toString());
    }
  }
}

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

curve.encode((LineString) geometry, atts, handler, parentId);
} else {
  throw new Exception("Unsupported geometry " + geometry.toString());

代码示例来源:origin: org.locationtech.geomesa/geomesa-cqengine

public String toString() {
  return "intersects(" +
      this.attribute.getAttributeName() +
      ", " +
      this.value.toString() +
      ")";
}

代码示例来源:origin: locationtech/jts

void rbWKT_actionPerformed(ActionEvent e) {
   writeView(
       test.getGeometry(0) == null ? null : test.getGeometry(0).toString(),
     test.getGeometry(1) == null ? null :test.getGeometry(1).toString(),
    test.getResult() == null ? null :test.getResult().toString()
       );
}

代码示例来源:origin: locationtech/jts

private String convertToWKT(Geometry g, boolean isFormatted)
{
  if (g == null) return "";
  if (! isFormatted)
    return g.toString();
  WKTWriter writer = new WKTWriter();
  writer.setFormatted(isFormatted);
  writer.setMaxCoordinatesPerLine(5);
  return writer.write(g);
}

代码示例来源:origin: locationtech/jts

public void testNoding() throws Exception {
 Geometry a = reader.read("LINESTRING(0 0, 100 100)");
 Geometry b = reader.read("LINESTRING(0 100, 100 0)");
 List lineStrings = Arrays.asList(new Object[] {a, b});
 Geometry nodedLineStrings = (LineString) lineStrings.get(0);
 for (int i = 1; i < lineStrings.size(); i++) {
  nodedLineStrings = nodedLineStrings.union((LineString)lineStrings.get(i));
 }
 assertEquals("MULTILINESTRING ((0 0, 50 50), (50 50, 100 100), (0 100, 50 50), (50 50, 100 0))", nodedLineStrings.toString());
}

代码示例来源:origin: locationtech/jts

public void testQuickPolygonUnion() throws Exception {
 Geometry a = reader.read("POLYGON((0 0, 100 0, 100 100, 0 100, 0 0))");
 Geometry b = reader.read("POLYGON((50 50, 150 50, 150 150, 50 150, 50 50))");
 Geometry[] polygons = new Geometry[] {a, b};
 GeometryCollection polygonCollection = new GeometryFactory().createGeometryCollection(polygons);
 Geometry union = polygonCollection.buffer(0);
 System.out.println(union);
 assertEquals("POLYGON ((0 0, 0 100, 50 100, 50 150, 150 150, 150 50, 100 50, 100 0, 0 0))", union.toString());
}

代码示例来源:origin: locationtech/jts

public void test6() throws Exception {
 WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
 Geometry actualGeometry = reader.read("MULTIPOINT (0 0, 5 1, 10 0)").convexHull();
 Geometry expectedGeometry = reader.read("POLYGON ((0 0, 5 1, 10 0, 0 0))");
 assertEquals(expectedGeometry.toString(), actualGeometry.toString());
}

相关文章