"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "bin/listgeo.c" between
libgeotiff-1.5.1.tar.gz and libgeotiff-1.6.0.tar.gz

About: libgeotiff is a library (built on top of libtiff) for reading and writing coordinate system information from and to GeoTIFF files (GeoTIFF establishes a TIFF based interchange format for georeferenced raster imagery).

listgeo.c  (libgeotiff-1.5.1):listgeo.c  (libgeotiff-1.6.0)
skipping to change at line 23 skipping to change at line 23
#include "geovalues.h" #include "geovalues.h"
#include "tiffio.h" #include "tiffio.h"
#include "cpl_serv.h" #include "cpl_serv.h"
#include <stdio.h> #include <stdio.h>
static void WriteTFWFile( GTIF * gtif, const char * tif_filename ); static void WriteTFWFile( GTIF * gtif, const char * tif_filename );
static void GTIFPrintCorners( GTIF *, GTIFDefn *, FILE *, int, int, int, int ); static void GTIFPrintCorners( GTIF *, GTIFDefn *, FILE *, int, int, int, int );
static TIFF *st_setup_test_info(); static TIFF *st_setup_test_info();
void Usage() void Usage()
{ {
printf( printf(
"%s", "%s",
"Usage: listgeo [-d] [-tfw] [-proj4] [-no_norm] [-t tabledir] filename\n " "Usage: listgeo [-d] [-tfw] [-proj4] [-no_norm] [-t tabledir] filename\n "
"\n" "\n"
" -d: report lat/long corners in decimal degrees instead of DMS.\n" " -d: report lat/long corners in decimal degrees instead of DMS.\n"
" -tfw: Generate a .tfw (ESRI TIFF World) file for the target file.\n" " -tfw: Generate a .tfw (ESRI TIFF World) file for the target file.\n"
" -proj4: Report PROJ.4 equivelent projection definition.\n" " -proj4: Report PROJ.4 equivalent projection definition.\n"
" -no_norm: Don't report 'normalized' parameter values.\n" " -no_norm: Don't report 'normalized' parameter values.\n"
" filename: Name of the GeoTIFF file to report on.\n" ); " filename: Name of the GeoTIFF file to report on.\n" );
exit( 1 ); exit( 1 );
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char *fname = NULL; char *fname = NULL;
TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */ TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
skipping to change at line 201 skipping to change at line 200
if( GTIFProj4ToLatLong( defn, 1, &x, &y ) ) if( GTIFProj4ToLatLong( defn, 1, &x, &y ) )
{ {
if (dec_flag) if (dec_flag)
{ {
fprintf( fp_out, " (%.7f,", x ); fprintf( fp_out, " (%.7f,", x );
fprintf( fp_out, "%.7f)", y ); fprintf( fp_out, "%.7f)", y );
} }
else else
{ {
fprintf( fp_out, " (%s,", GTIFDecToDMS( x, "Long", 2 ) ); const char* pszLong = GTIFDecToDMS( x, "Long", 2 );
fprintf( fp_out, "%s)", GTIFDecToDMS( y, "Lat", 2 ) ); if( pszLong[0] == 0 )
{
fprintf( fp_out, " (invalid)" );
}
else
{
fprintf( fp_out, " (%s,", pszLong );
fprintf( fp_out, "%s)", GTIFDecToDMS( y, "Lat", 2 ) );
}
} }
} }
fprintf( fp_out, "\n" ); fprintf( fp_out, "\n" );
} }
if( inv_flag && GTIFPCSToImage( gtif, &x_saved, &y_saved ) ) if( inv_flag && GTIFPCSToImage( gtif, &x_saved, &y_saved ) )
{ {
fprintf( fp_out, " inverse (%11.3f,%11.3f)\n", x_saved, y_saved ); fprintf( fp_out, " inverse (%11.3f,%11.3f)\n", x_saved, y_saved );
} }
return TRUE; return TRUE;
} }
static void GTIFPrintCorners( GTIF *gtif, GTIFDefn *defn, FILE * fp_out, static void GTIFPrintCorners( GTIF *gtif, GTIFDefn *defn, FILE * fp_out,
int xsize, int ysize, int inv_flag, int dec_flag ) int xsize, int ysize, int inv_flag, int dec_flag )
{ {
printf( "\nCorner Coordinates:\n" ); printf( "\nCorner Coordinates:\n" );
unsigned short raster_type = RasterPixelIsArea;
GTIFKeyGetSHORT(gtif, GTRasterTypeGeoKey, &raster_type, 0, 1);
double xmin = (raster_type == RasterPixelIsArea) ? 0.0 : -0.5;
double ymin = xmin;
double ymax = ymin + ysize;
double xmax = xmin + xsize;
if( !GTIFReportACorner( gtif, defn, fp_out, if( !GTIFReportACorner( gtif, defn, fp_out,
"Upper Left", 0.0, 0.0, inv_flag, dec_flag ) ) "Upper Left", xmin, ymin, inv_flag, dec_flag ) )
{ {
printf( " ... unable to transform points between pixel/line and PCS spac e\n" ); printf( " ... unable to transform points between pixel/line and PCS spac e\n" );
return; return;
} }
GTIFReportACorner( gtif, defn, fp_out, "Lower Left", 0.0, ysize, GTIFReportACorner( gtif, defn, fp_out, "Lower Left", xmin, ymax,
inv_flag, dec_flag ); inv_flag, dec_flag );
GTIFReportACorner( gtif, defn, fp_out, "Upper Right", xsize, 0.0, GTIFReportACorner( gtif, defn, fp_out, "Upper Right", xmax, ymin,
inv_flag, dec_flag ); inv_flag, dec_flag );
GTIFReportACorner( gtif, defn, fp_out, "Lower Right", xsize, ysize, GTIFReportACorner( gtif, defn, fp_out, "Lower Right", xmax, ymax,
inv_flag, dec_flag ); inv_flag, dec_flag );
GTIFReportACorner( gtif, defn, fp_out, "Center", xsize/2.0, ysize/2.0, GTIFReportACorner( gtif, defn, fp_out, "Center", xmin + xsize/2.0, ymin + ys ize/2.0,
inv_flag, dec_flag ); inv_flag, dec_flag );
} }
/* /*
* Write the defining matrix for this file to a .tfw file with the same * Write the defining matrix for this file to a .tfw file with the same
* basename. * basename.
*/ */
static void WriteTFWFile( GTIF * gtif, const char * tif_filename ) static void WriteTFWFile( GTIF * gtif, const char * tif_filename )
 End of changes. 9 change blocks. 
9 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)