Package org.postgis.jts

Examples of org.postgis.jts.JtsGeometry


    return tags;
  }

  @Nullable
  public static <T extends Geometry> T extractGeometry(ResultSet rs, String columnName) throws SQLException {
    JtsGeometry geom = (JtsGeometry) rs.getObject(columnName);
    if(geom == null) {
      //info("no geometry found in column " + columnName);
      return null;
    }
    return (T) geom.getGeometry();
  }
View Full Code Here


     * Pass a geometry representation through the SQL server via prepared
     * statement
     */
    private static Geometry viaPrepSQL(Geometry geom, Connection conn) throws SQLException {
        PreparedStatement prep = conn.prepareStatement("SELECT ?::geometry");
        JtsGeometry wrapper = new JtsGeometry(geom);
        prep.setObject(1, wrapper, Types.OTHER);
        ResultSet rs = prep.executeQuery();
        rs.next();
        JtsGeometry resultwrapper = ((JtsGeometry) rs.getObject(1));
        return resultwrapper.getGeometry();
    }
View Full Code Here

    private static Geometry binaryViaSQL(byte[] rep, Connection conn) throws SQLException {
        PreparedStatement prep = conn.prepareStatement("SELECT ?::bytea::geometry");
        prep.setBytes(1, rep);
        ResultSet rs = prep.executeQuery();
        rs.next();
        JtsGeometry resultwrapper = ((JtsGeometry) rs.getObject(1));
        return resultwrapper.getGeometry();
    }
View Full Code Here

TOP

Related Classes of org.postgis.jts.JtsGeometry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.