/****************************************************************/ /* */ /* print_rasterbandinfo - Displays the raster statistics. */ /* */ /* arguments: */ /* */ /* connection - the connection */ /* handle. */ /* rasterband - the rasterband */ /* info structure. */ /* */ /****************************************************************/ void print_rasterbandinfo ( SE_CONNECTION connection, SE_RASBANDINFO rasterband) { LONG rc, compression_type, rasterband_id, pixel_type, block_width, block_depth, rastercolumn_id, sequence_nbr, raster_id, band_width, band_height, max_level, skip_level1, cseconds, mseconds; LFLOAT tilex, tiley; struct tm bandtime; CHAR am_pm[3] = "AM\0", band_name[SE_MAX_DESCRIPTION_LEN]; SE_ENVELOPE raster_env; /* Display the compression type */ rc = SE_rasbandinfo_get_compression_type( rasterband, &compression_type); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_compression_type"); switch(compression_type) { case 0: printf("Image compression type is NONE \n"); break; case 1: printf("Image compression type is LZ77\n"); break; case 2: printf("Image compression type is JPEG\n"); break; case 3: printf("Image compression type is JP2000\n"); break; default: printf("Unknown image type \n"); break; } /* Display the rasterband ID */ rc = SE_rasbandinfo_get_id (rasterband, &rasterband_id); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_id"); printf("Rasterband ID: %d\n",rasterband_id); /* Display the rasterband pixel type */ rc = SE_rasbandinfo_get_pixel_type (rasterband, &pixel_type); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_pixel_type"); print_pixel_type (pixel_type); /* Display the rasterband tile size */ rc = SE_rasbandinfo_get_tile_size (rasterband, &block_width, &block_depth); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_tile_size"); printf("Tile block width: %d\n",block_width); printf("Tile block height: %d\n",block_depth); /* Display the rasterband tile origin */ rc = SE_rasbandinfo_get_tile_origin (rasterband, &tilex, &tiley); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_tile_origin"); printf("Tile origin X: %lf \n",tilex); printf("Tile origin Y: %lf \n",tiley); /* Display the rasterband raster column ID */ rc = SE_rasbandinfo_get_rascol_id (rasterband, &rastercolumn_id); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_rascol_id"); printf("Raster column ID: %d\n",rastercolumn_id); /* Display the rasterband sequence number */ rc = SE_rasbandinfo_get_band_number (rasterband, &sequence_nbr); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_band_number"); printf ("Raster band sequence number: %d\n",sequence_nbr); /* Display the raster ID */ rc = SE_rasbandinfo_get_raster_id (rasterband, &raster_id); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_id"); printf("Raster ID: %d \n",raster_id); /* Display the rasterband create time */ rc = SE_rasbandinfo_get_time ( rasterband, SE_RASTERBAND_CREATED, &bandtime); check_error (rc, NULL, NULL,"SE_rasbandinfo_get_time"); /* If the SE_RASBANDINFO structure has been populated with a call to */ /* SE_rastercolumn_create the create time will be populated. */ if( bandtime.tm_hour > 12 ) /* Set AM or PM. */ strcpy( am_pm, "PM" ); if ( bandtime.tm_hour > 12 ) /* Convert from 24-hour */ bandtime.tm_hour -= 12; /* to 12-hour clock. */ if ( bandtime.tm_hour == 0 ) /* Set hour to 12 if midnight. */ bandtime.tm_hour = 12; printf("Create time: %.19s %s\n", asctime( &bandtime ), am_pm ); cseconds = bandtime.tm_sec; /* Display the rasterband modified time */ rc = SE_rasbandinfo_get_time ( rasterband, SE_RASTERBAND_MODIFIED, &bandtime); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_time"); /* If the SE_RASBANDINFO structure has been populated with a call to */ /* SE_rastercolumn_create the modified time will be populated. */ if ( bandtime.tm_hour > 12 ) /* Set AM or PM. */ strcpy( am_pm, "PM" ); if ( bandtime.tm_hour > 12 ) /* Convert from 24-hour */ bandtime.tm_hour -= 12; /* to 12-hour clock. */ if( bandtime.tm_hour == 0 ) /* Set hour to 12 if midnight. */ bandtime.tm_hour = 12; printf("Last modified time: %.19s %s\n", asctime( &bandtime ), am_pm ); mseconds = bandtime.tm_sec; if(mseconds != cseconds) printf("Modification time is different than create time.\n"); else printf("Modification time is the same as the create time.\n"); /* Display the band size */ rc = SE_rasbandinfo_get_band_size (rasterband, &band_width, &band_height); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_band_size"); printf("Raster band width: %d \n",band_width); printf("Raster band height: %d \n",band_height); /* Display the rasterband extent */ rc = SE_rasbandinfo_get_extent (rasterband, &raster_env); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_extent"); printf ("Raster extent minimum X: %lf\n",raster_env.minx); printf ("Raster extent minimum Y: %lf\n",raster_env.miny); printf ("Raster extent maximum X: %lf\n",raster_env.maxx); printf ("Raster extent maximum Y: %lf\n",raster_env.maxy); /* Display the maximum pyramid level and whether to skip the first level */ rc = SE_rasbandinfo_get_max_level (rasterband, &max_level, &skip_level1); check_error (rc, NULL, NULL,"SE_rasbandinfo_get_max_level"); printf("Raster band maximum level: %d\n",max_level); if (skip_level1) printf("Skip the first level\n"); else printf("Do not skip the first level\n"); /* Display the band name */ rc = SE_rasbandinfo_get_band_name (rasterband, band_name); check_error (rc, NULL, NULL, "SE_rasbandinfo_get_band_name"); printf("Raster band name: %s \n",band_name); return; } /* print_rasterbandinfo */