@Override public Geometry toParticle( ResultSet rs, int colIndex ) throws SQLException { byte[] wkb = rs.getBytes( colIndex ); if ( wkb == null ) { return null; } try { return WKBReader.read( wkb, crs ); } catch ( Throwable t ) { throw new IllegalArgumentException( t.getMessage(), t ); } }
@Override public Geometry toParticle( ResultSet rs, int colIndex ) throws SQLException { Object sqlValue = rs.getObject( colIndex ); try { if ( sqlValue != null ) { if ( sqlValue instanceof byte[] ) { if ( is2d ) { return WKBReader.read( (byte[]) sqlValue, crs ); } // hur hur, not using cp1252 any more, are we? sqlValue = new String( (byte[]) sqlValue, "UTF-16LE" ); } return new WKTReader( crs ).read( sqlValue.toString() ); } } catch ( Throwable e ) { throw new SQLException( e ); } return null; }
public Geometry read( String wkt ) throws ParseException { try { org.postgis.Geometry g = org.postgis.PGgeometry.geomFromString( wkt ); byte[] bs = new BinaryWriter().writeBinary( g ); return WKBReader.read( bs, crs ); } catch ( SQLException e ) { e.printStackTrace(); // wrap the exception nicely as to not break 172643521 API calls throw new ParseException( e ); } }
if ( bs != null ) { try { Geometry geom = WKBReader.read( bs, crs ); props.add( new GenericProperty( pt, geom ) ); } catch ( ParseException e ) {