public static List < LasLevel > getLasLevels ( ASpatialDb db , int levelNum , Envelope envelope ) throws Exception { String tableName = TABLENAME + levelNum ; List < LasLevel > lasLevels = new ArrayList <> ( ) ; String sql = "SELECT " + COLUMN_GEOM + "," + // COLUMN_ID + "," + COLUMN_SOURCE_ID + "," + COLUMN_AVG_ELEV + "," + // COLUMN_MIN_ELEV + "," + // COLUMN_MAX_ELEV + "," + // COLUMN_AVG_INTENSITY + "," + // COLUMN_MIN_INTENSITY + "," + // COLUMN_MAX_INTENSITY ; sql += " FROM " + tableName ; if ( envelope != null ) { double x1 = envelope . getMinX ( ) ; double y1 = envelope . getMinY ( ) ; double x2 = envelope . getMaxX ( ) ; double y2 = envelope . getMaxY ( ) ; sql += " WHERE " + db . getSpatialindexBBoxWherePiece ( tableName , null , x1 , y1 , x2 , y2 ) ; } String _sql = sql ; IGeometryParser gp = db . getType ( ) . getGeometryParser ( ) ; return db . execOnConnection ( conn -> { try ( IHMStatement stmt = conn . createStatement ( ) ; IHMResultSet rs = stmt . executeQuery ( _sql ) ) { while ( rs . next ( ) ) { LasLevel lasLevel = new LasLevel ( ) ; lasLevel . level = levelNum ; int i = 1 ; Geometry geometry = gp . fromResultSet ( rs , i ++ ) ; if ( geometry instanceof Polygon ) { Polygon polygon = ( Polygon ) geometry ; lasLevel . polygon = polygon ; lasLevel . id = rs . getLong ( i ++ ) ; lasLevel . sourceId = rs . getLong ( i ++ ) ; lasLevel . avgElev = rs . getDouble ( i ++ ) ; lasLevel . minElev = rs . getDouble ( i ++ ) ; lasLevel . maxElev = rs . getDouble ( i ++ ) ; lasLevel . avgIntensity = rs . getShort ( i ++ ) ; lasLevel . minIntensity = rs . getShort ( i ++ ) ; lasLevel . maxIntensity = rs . getShort ( i ++ ) ; lasLevels . add ( lasLevel ) ; } } return lasLevels ; } } ) ; }
Query the las level table .