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

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

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

Wkt.newDecoder介绍

[英]Creates a WktDecoder for the default dialect (Postgis 1.x EWKT).
[中]为默认方言(Postgis 1.x EWKT)创建一个WktDecoder

代码示例

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

public static WktDecoder getWktDecoder(Dialect dialect) {
    WktDecoder decoder = null;
    if ( dialect instanceof AbstractHANADialect ) {
      decoder = Wkt.newDecoder( Wkt.Dialect.HANA_EWKT );
    }
    else if ( dialect instanceof DB2SpatialDialect ) {
      decoder = Wkt.newDecoder( Wkt.Dialect.DB2_WKT );
    }
    else {
      decoder = Wkt.newDecoder( Wkt.Dialect.POSTGIS_EWKT_1 );
    }
    return decoder;
  }
}

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

private static Geometry<?> parseWkt(String pgValue) {
  final WktDecoder decoder = Wkt.newDecoder( Wkt.Dialect.POSTGIS_EWKT_1 );
  return decoder.decode( pgValue );
}

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

WktDecoder decoder = Wkt.newDecoder();
for ( TestDataElement testDataElement : testData ) {
  if ( testDataElement.type.equalsIgnoreCase( type ) ) {

代码示例来源:origin: org.geolatte/geolatte-geom

/**
* Creates a <code>WktDecoder</code> for the default dialect (Postgis 1.x EWKT).
 * @return an <code>WktDecoder</code> that supports the default dialect
 * @return
 */
public static WktDecoder newDecoder() {
  return newDecoder(DEFAULT_DIALECT);
}

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

@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
  Clob clob = rs.getClob(startIndex);
  String str = clob != null ? clob.getSubString(1, (int) clob.length()) : null;
  if (str != null) {
    return Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode(str);
  } else {
    return null;
  }
}

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

@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
  Clob clob = rs.getClob(startIndex);
  String str = clob != null ? clob.getSubString(1, (int) clob.length()) : null;
  if (str != null) {
    return Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode(str);
  } else {
    return null;
  }
}

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

@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
  String str = rs.getString(startIndex);
  if (str != null) {
    return Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode(str);
  } else {
    return null;
  }
}

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

@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
  String str = rs.getString(startIndex);
  if (str != null) {
    return Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode(str);
  } else {
    return null;
  }
}

代码示例来源:origin: org.geolatte/geolatte-geom

/**
 * Decodes the specified WKT String to a <code>Geometry</code>.
 * <p>This method uses the default WKT dialect (Postgis v1.5 EWKT)</p>
 *
 * @param wkt the WKT string to decode
 * @return The decoded Geometry
 */
public static <P extends Position> Geometry<P> fromWkt(String wkt, CoordinateReferenceSystem<P> crs) {
  WktDecoder decoder = newDecoder();
  return decoder.decode(wkt,crs);
}

代码示例来源:origin: org.geolatte/geolatte-geom

public static Geometry<?> fromWkt(String wkt) {
  WktDecoder decoder = newDecoder();
  return decoder.decode(wkt);
}

代码示例来源:origin: org.geolatte/geolatte-geom

@Override
public Geometry<?> decode(Clob clob) {
  String wkt = clobToString( clob );
  WktDecoder decoder = Wkt.newDecoder( Wkt.Dialect.DB2_WKT );
  if ( wkt.substring( 0, 4 ).toUpperCase().startsWith( "SRID" ) ) {
    return decoder.decode( wkt );
  }
  else {
    return decoder.decode( String.format( "SRID=%d;%s", srid, wkt ) );
  }
}

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

@Test
public void valid_wkt() {
  for (String wkt : Connections.getSpatialData().values()) {
    assertNotNull(Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode(wkt));
  }
}

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

private Object convertInternal(Object obj){
  if (obj instanceof PGobject){
     String pgValue = ((PGobject)obj).getValue();
     if (pgValue.charAt(0) == 'S') {
       WktDecoder decoder = Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1);
       return decoder.decode(pgValue);
     }
     ByteBuffer buffer = ByteBuffer.from(pgValue);
     WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
     return decoder.decode(buffer);
  }
  byte[] bytes=Converters.getDefault().convertObject(obj, byte[].class);
  WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
  return decoder.decode(ByteBuffer.from(bytes));
}

相关文章