Ejemplo n.º 1
0
 /*
  * (non-Javadoc)
  *
  * @see org.geotools.gce.imagemosaic.jdbc.JDBCAccessBase#setGridSelectParams(java.sql.PreparedStatement,
  *      org.geotools.geometry.GeneralEnvelope, org.geotools.gce.imagemosaic.jdbc.ImageLevelInfo)
  */
 @Override
 protected void setGridSelectParams(
     PreparedStatement s, GeneralEnvelope envelope, ImageLevelInfo li) throws SQLException {
   WKBWriter w = new WKBWriter();
   byte[] bytes = w.write(polyFromEnvelope(envelope));
   s.setBytes(1, bytes);
   s.setInt(2, li.getSrsId());
 }
Ejemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see org.geotools.gce.imagemosaic.jdbc.JDBCAccessBase#getCRS(org.geotools.gce.imagemosaic.jdbc.ImageLevelInfo,
   *      java.sql.Connection)
   */
  @Override
  protected CoordinateReferenceSystem getCRS(ImageLevelInfo li, Connection con) throws IOException {
    CoordinateReferenceSystem result = null;

    try {
      PreparedStatement s = con.prepareStatement(CRSSelect);
      s.setInt(1, li.getSrsId());

      ResultSet r = s.executeQuery();

      if (r.next()) {
        String definition = r.getString(1);
        result = CRS.parseWKT(definition);
      }

      r.close();
      s.close();
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      throw new IOException(e);
    }

    return result;
  }