本文整理了Java中org.geolatte.geom.codec.WkbDecoder.decode()
方法的一些代码示例,展示了WkbDecoder.decode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WkbDecoder.decode()
方法的具体详情如下:
包路径:org.geolatte.geom.codec.WkbDecoder
类名称:WkbDecoder
方法名:decode
[英]Decodes a WKB encoded representation of a Geometry
[中]解码Geometry
的WKB编码表示形式
代码示例来源:origin: hibernate/hibernate-orm
private static Geometry<?> toGeometry(ByteBuffer buffer) {
if ( buffer == null ) {
return null;
}
WkbDecoder decoder = Wkb.newDecoder( Wkb.Dialect.HANA_EWKB );
return decoder.decode( buffer );
}
代码示例来源:origin: hibernate/hibernate-orm
private Geometry toGeometry(byte[] bytes) {
if ( bytes == null ) {
return null;
}
final ByteBuffer buffer = ByteBuffer.from( bytes );
final WkbDecoder decoder = Wkb.newDecoder( Wkb.Dialect.MYSQL_WKB );
return decoder.decode( buffer );
}
代码示例来源:origin: hibernate/hibernate-orm
public static Geometry<?> toGeometry(Object object) {
if ( object == null ) {
return null;
}
ByteBuffer buffer = null;
if ( object instanceof PGobject ) {
String pgValue = ( (PGobject) object ).getValue();
if ( pgValue.startsWith( "00" ) || pgValue.startsWith( "01" ) ) {
//we have a WKB because this pgValue starts with the bit-order byte
buffer = ByteBuffer.from( pgValue );
final WkbDecoder decoder = Wkb.newDecoder( Wkb.Dialect.POSTGIS_EWKB_1 );
return decoder.decode( buffer );
}
else {
return parseWkt( pgValue );
}
}
throw new IllegalStateException( "Received object of type " + object.getClass().getCanonicalName() );
}
代码示例来源:origin: hibernate/hibernate-orm
return decoder.decode( toByteBuffer( (Blob) object ) );
return decoder.decode( ByteBuffer.from( (byte[]) object ) );
代码示例来源:origin: hibernate/hibernate-orm
@Override
protected Geometry decode(Object bytes) {
if ( bytes == null ) {
return null;
}
ByteBuffer buffer = ByteBuffer.from( (byte[]) bytes );
WkbDecoder decoder = Wkb.newDecoder( Wkb.Dialect.MYSQL_WKB );
return JTS.to( decoder.decode( buffer ) );
}
}
代码示例来源:origin: org.geolatte/geolatte-geom
/**
* Decodes a WKB representation in a <code>ByteBuffer</code> to a <code>Geometry</code>.
* <p>This methods uses the default WKB dialect (Postgis v1.5 EWKB ).</p>
*
* @param byteBuffer A buffer of bytes that contains a WKB-encoded <code>Geometry</code>.
* @return The <code>Geometry</code> that is encoded in the WKB.
*/
public static Geometry<?> fromWkb(ByteBuffer byteBuffer) {
WkbDecoder decoder = newDecoder(DEFAULT_DIALECT);
return decoder.decode(byteBuffer);
}
代码示例来源:origin: com.mysema.querydsl/querydsl-sql
@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
byte[] bytes = rs.getBytes(startIndex);
if (bytes != null) {
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(bytes));
} else {
return null;
}
}
代码示例来源:origin: com.querydsl/querydsl-sql-spatial
@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
byte[] bytes = rs.getBytes(startIndex);
if (bytes != null) {
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(bytes));
} else {
return null;
}
}
代码示例来源:origin: com.querydsl/querydsl-sql-spatial
@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
byte[] bytes = rs.getBytes(startIndex);
if (bytes != null) {
byte[] wkb = new byte[bytes.length - 4];
System.arraycopy(bytes, 4, wkb, 0, wkb.length);
int srid = bytes[3] << 24 | (bytes[2] & 0xff) << 16 | (bytes[1] & 0xff) << 8 | (bytes[0] & 0xff);
// TODO make sure srid is set
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(wkb));
} else {
return null;
}
}
代码示例来源:origin: com.mysema.querydsl/querydsl-sql
@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
byte[] bytes = rs.getBytes(startIndex);
if (bytes != null) {
byte[] wkb = new byte[bytes.length - 4];
System.arraycopy(bytes, 4, wkb, 0, wkb.length);
int srid = bytes[3] << 24 | (bytes[2] & 0xff) << 16 | (bytes[1] & 0xff) << 8 | (bytes[0] & 0xff);
// TODO make sure srid is set
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(wkb));
} else {
return null;
}
}
代码示例来源:origin: com.sqlapp/sqlapp-core-h2
@Override
public Object getObject(ResultSet rs, int columnIndex)
throws SQLException {
byte[] bytes=rs.getBytes(columnIndex);
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(bytes));
}
代码示例来源:origin: com.sqlapp/sqlapp-core-h2
@Override
public Object getObject(ResultSet rs, String columnLabel)
throws SQLException {
byte[] bytes=rs.getBytes(columnLabel);
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(bytes));
}
代码示例来源:origin: com.querydsl/querydsl-sql-spatial
@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
byte[] bytes = rs.getBytes(startIndex);
if (bytes != null) {
byte[] wkb;
if (bytes[0] != 0 && bytes[0] != 1) { // decodes EWKB
wkb = new byte[bytes.length - 32];
System.arraycopy(bytes, 32, wkb, 0, wkb.length);
} else {
wkb = bytes;
}
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(wkb));
} else {
return null;
}
}
代码示例来源:origin: com.mysema.querydsl/querydsl-sql
@Override
@Nullable
public Geometry getValue(ResultSet rs, int startIndex) throws SQLException {
byte[] bytes = rs.getBytes(startIndex);
if (bytes != null) {
byte[] wkb;
if (bytes[0] != 0 && bytes[0] != 1) { // decodes EWKB
wkb = new byte[bytes.length - 32];
System.arraycopy(bytes, 32, wkb, 0, wkb.length);
} else {
wkb = bytes;
}
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.POSTGIS_EWKB_1);
return decoder.decode(ByteBuffer.from(wkb));
} else {
return null;
}
}
代码示例来源:origin: com.sqlapp/sqlapp-core-mysql
private Object toGeometry(byte[] bytes){
ByteBuffer buffer = ByteBuffer.from(bytes);
WkbDecoder decoder = Wkb.newDecoder(Wkb.Dialect.MYSQL_WKB);
return decoder.decode(buffer);
}
代码示例来源: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));
}
内容来源于网络,如有侵权,请联系作者删除!