/** Returns the text representation of the envelope of the geometry. */ public static String EnvelopeAsText(byte[] wkb) { Envelope e = Envelope(wkb); if (e != null) { return e.toString(); } return null; }
/** Returns the Well Known Text of the geometry. */ public static String AsWKT(byte[] wkb) { if (wkb == null) { return null; } return fromWKB(wkb).toText(); }
/** * Reads a geometry from its well known text representation, specifying an srid. * * @param wkt The well known text of the geometry. * @param srid The srid of the geometry * @return An array of bytes representing the geometry. */ public static byte[] GeomFromText(String wkt, int srid) { if (wkt == null) { return null; } WKTReader reader = new WKTReader(); try { Geometry g = reader.read(wkt); g.setSRID(srid); return toWKB(g); } catch (ParseException e) { throw new RuntimeException(e); } }
/** * Returns the spatial reference identifier for the geometry. * * <p>This method will return -1 if <tt>wkb</tt> is <code>null</code>. * * @param wkb The geometry. * @return The srid. */ public static int GetSRID(byte[] wkb) { if (wkb == null) { return -1; } return fromWKB(wkb).getSRID(); }
/** * Returns the text representation of the envelope of the geometry. */ public static String EnvelopeAsText( byte[] wkb ) { Envelope e = Envelope( wkb ); if ( e != null ) { return e.toString(); } return null; }
/** * Reads a geometry from its well known text representation, specifying an * srid. * * @param wkt The well known text of the geometry. * @param srid The srid of the geometry * * @return An array of bytes representing the geometry. */ public static byte[] GeomFromText(String wkt, int srid) { if ( wkt == null ) { return null; } WKTReader reader = new WKTReader(); try { Geometry g = reader.read( wkt ); g.setSRID(srid); return toWKB( g ); } catch (ParseException e) { throw new RuntimeException( e ); } }
/** * Returns the type of the geometry as a string. Eg: 'LINESTRING', 'POLYGON', 'MULTIPOINT', etc. * * <p>This method returns <code>null</code> when <tt>wkb</tt> is <code>null</code>. * * @param wkb The geometry. */ public static String GeometryType(byte[] wkb) { if (wkb == null) { return null; } Geometry g = fromWKB(wkb); return g != null ? g.getGeometryType().toUpperCase() : null; }
/** * Returns the envelope for a geometry. * * <p>This method will return an "null" envelope ({@link Envelope#setToNull()}) if <tt>wkb</tt> * is <code>null</code>. * * @param wkb The geometry. * @return The envelope of the geometry. */ public static Envelope Envelope(byte[] wkb) { if (wkb == null) { Envelope e = new Envelope(); e.setToNull(); return e; } return fromWKB(wkb).getEnvelopeInternal(); }
/** * Returns the Well Known Text of the geometry. */ public static String AsWKT( byte[] wkb ) { if ( wkb == null ) { return null; } return fromWKB(wkb).toText(); }
/** * Returns the spatial reference identifier for the geometry. * <p> * This method will return -1 if <tt>wkb</tt> is <code>null</code>. * </p> * @param wkb The geometry. * * @return The srid. */ public static int GetSRID( byte[] wkb ) { if ( wkb == null ) { return -1; } return fromWKB(wkb).getSRID(); }
/** * Returns the type of the geometry as a string. Eg: 'LINESTRING', 'POLYGON', * 'MULTIPOINT', etc. * <p> * This method returns <code>null</code> when <tt>wkb</tt> is <code>null</code>. * </p> * @param wkb The geometry. */ public static String GeometryType( byte[] wkb ) { if ( wkb == null ) { return null; } Geometry g = fromWKB( wkb ); return g != null ? g.getGeometryType().toUpperCase() : null; }
/** * Returns the envelope for a geometry. * <p> * This method will return an "null" envelope ({@link Envelope#setToNull()}) * if <tt>wkb</tt> is <code>null</code>. * </p> * @param wkb The geometry. * @return The envelope of the geometry. */ public static Envelope Envelope( byte[] wkb ) { if ( wkb == null ) { Envelope e = new Envelope(); e.setToNull(); return e; } return fromWKB(wkb).getEnvelopeInternal(); }