private String getTypeExpr(Type fieldType) {
   int precision = fieldType.getIntConstraint(Constraint.PRECISION);
   int scale = fieldType.getIntConstraint(Constraint.SCALE);
   if (scale == -1) {
     return "double precision";
   } else if (scale < 15) {
     return "double precision";
   } else {
     return "numeric(" + precision + ", " + scale + ")";
   }
 }
Example #2
0
 private void testOpen(File file) throws Exception {
   GeoRaster gr = GeoRasterFactory.createGeoRaster(file.getAbsolutePath());
   gr.open();
   int rasterType = gr.getType();
   DataSource ds = dsf.getDataSource(file);
   ds.open();
   Metadata metadata = ds.getMetadata();
   Type fieldType = metadata.getFieldType(0);
   assertTrue(fieldType.getIntConstraint(Constraint.RASTER_TYPE) == rasterType);
   ds.getFieldValue(0, 0);
   ds.close();
 }