org.geolatte.geom.codec.Wkt.fromWkt()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(159)

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

Wkt.fromWkt介绍

[英]Decodes the specified WKT String to a Geometry.

This method uses the default WKT dialect (Postgis v1.5 EWKT)
[中]将指定的WKT字符串解码为Geometry
此方法使用默认的WKT方言(Postgis v1.5 EWKT)

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
public Geometry fromString(String string) {
  return Wkt.fromWkt( string );
}

代码示例来源:origin: beihaifeiwu/dolphin

@Override
public Geometry getNullableResult(ResultSet rs, String columnName) throws SQLException {
  String value = rs.getString(columnName);
  if(!StringUtils.isEmpty(value)){
    return Wkt.fromWkt(value);
  }
  return null;
}

代码示例来源:origin: beihaifeiwu/dolphin

@Override
public Geometry getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
  String value = rs.getString(columnIndex);
  if(!StringUtils.isEmpty(value)){
    return Wkt.fromWkt(value);
  }        
  return null;
}

代码示例来源:origin: beihaifeiwu/dolphin

@Override
public Geometry getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
  String value = cs.getString(columnIndex);
  if(!StringUtils.isEmpty(value)){
    return Wkt.fromWkt(value);
  }            
  return null;
}

代码示例来源:origin: com.sqlapp/sqlapp-core

@Override
public org.geolatte.geom.Geometry<?> convertObject(Object value) {
  if (isEmpty(value)){
    return getDefaultValue();
  }else if (value instanceof org.geolatte.geom.Geometry){
    return (org.geolatte.geom.Geometry<?>)value;
  }else if (value instanceof String){
    return Wkt.fromWkt((String)value);
  }else if (value instanceof com.vividsolutions.jts.geom.Geometry){
    return JTS.from((com.vividsolutions.jts.geom.Geometry)value);
  }
  throw new IllegalArgumentException("value="+value);
}

代码示例来源:origin: com.querydsl/querydsl-sql-spatial

data.add(Wkt.fromWkt(wkt));

代码示例来源:origin: com.querydsl/querydsl-sql-spatial

@Test
public void polygon() {
  Polygon polygon = (org.geolatte.geom.Polygon) Wkt.fromWkt("POLYGON (" +
      "(30 10, 40 40, 20 40, 10 20, 30 10), " +
      "(20 30, 35 35, 30 20, 20 30))");
  JGeometry geo = JGeometryConverter.convert(polygon);
  double[] extRing = new double[]{30, 10, 40, 40, 20, 40, 10, 20, 30, 10};
  double[] intRing = new double[]{20, 30, 35, 35, 30, 20, 20, 30};
  JGeometry geo2 = JGeometry.createLinearPolygon(new Object[]{extRing, intRing},
      polygon.getCoordinateDimension(), polygon.getSRID());
  assertEquals(geo2, geo);
}

代码示例来源:origin: com.querydsl/querydsl-sql-spatial

@Test
public void point_methods2() {
  QShapes shapes1 = QShapes.shapes;
  QShapes shapes2 = new QShapes("shapes2");
  List<Expression<?>> expressions = Lists.newArrayList();
  expressions.addAll(createExpressions(shapes1.geometry.asPoint(), shapes2.geometry.asPoint()));
  expressions.addAll(createExpressions(shapes1.geometry.asPoint(), ConstantImpl.create((Point) Wkt.fromWkt("Point(2 2)"))));
  for (Expression<?> expr : expressions) {
    boolean logged = false;
    for (Object row : query().from(shapes1, shapes2)
        .where(shapes1.id.loe(5), shapes2.id.loe(5)).select(expr).fetch()) {
      if (row == null && !logged) {
        System.err.println(expr.toString());
        logged = true;
      }
    }
  }
}

代码示例来源:origin: com.querydsl/querydsl-sql-spatial

@Test
  public void multiLineString() {
    MultiLineString multiLineString = (org.geolatte.geom.MultiLineString) Wkt.fromWkt("MULTILINESTRING (" +
            "(30 10, 40 40, 20 40, 10 20, 30 10), " +
            "(20 30, 35 35, 30 20, 20 30))");
    JGeometry geo = JGeometryConverter.convert(multiLineString);

    double[] line1 = new double[]{30, 10, 40, 40, 20, 40, 10, 20, 30, 10};
    double[] line2 = new double[]{20, 30, 35, 35, 30, 20, 20, 30};
    JGeometry geo2 = JGeometry.createLinearMultiLineString(new Object[]{line1, line2},
        multiLineString.getCoordinateDimension(), multiLineString.getSRID());
//        System.err.println(Arrays.toString(geo.getElemInfo()));
//        System.err.println(Arrays.toString(geo.getOrdinatesArray()));
//        System.err.println(Arrays.toString(geo2.getElemInfo()));
//        System.err.println(Arrays.toString(geo2.getOrdinatesArray()));
    assertEquals(geo2, geo);
  }

相关文章