public static Geometry toGeometry ( byte [ ] bytes , int srid ) throws SQLException { if ( bytes == null ) { return null ; } WKBReader wkbReader = new WKBReader ( ) ; try { Geometry geometry = wkbReader . read ( bytes ) ; geometry . setSRID ( srid ) ; return geometry ; } catch ( ParseException ex ) { throw new SQLException ( "Cannot parse the input bytes" , ex ) ; } }
Convert a WKB representation to a geometry