Opened 17 years ago
Closed 16 years ago
#1392 closed enhancement (fixed)
patch to add more informative error messages to gdal_crs.c
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | highest | Milestone: | |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | minor | Keywords: | |
Cc: | Markus Neteler |
Description
The crs.c code actually has more informative error indications than was being thrown via CPLError(). This patch gives the developer slightly more clue as to where things went wrong. diff -Naur gdal-1.3.2/alg/gdal_crs.c gdal-1.3.2-new/alg/gdal_crs.c --- gdal-1.3.2/alg/gdal_crs.c 2004-12-26 11:12:21.000000000 -0500 +++ gdal-1.3.2-new/alg/gdal_crs.c 2006-12-12 16:23:38.000000000 -0500 @@ -101,6 +101,13 @@ void *GDALDeserializeGCPTransformer( CPLXMLNode *psTree ); CPL_C_END +static char *CRS_error_message[] = { + "Failed to compute GCP transform: Not enough points available", + "Failed to compute GCP transform: Transform is not solvable", + "Failed to compute GCP transform: Not enough memory" + "Failed to compute GCP transform: Parameter error", + "Failed to compute GCP transform: Internal error" +}; /* crs.c */ static int CRS_georef(double, double, double *, double *, double [], double [], int); @@ -217,14 +224,13 @@ /* -------------------------------------------------------------------- */ /* Compute the forward and reverse polynomials. */ /* -------------------------------------------------------------------- */ - if( CRS_compute_georef_equations( &sPoints, + int nCRSresult = CRS_compute_georef_equations( &sPoints, psInfo->adfToGeoX, psInfo->adfToGeoY, psInfo->adfFromGeoX, psInfo->adfFromGeoY, - nReqOrder ) != 1 ) + nReqOrder ); + if (nCRSresult != 1 ) { - CPLError( CE_Failure, CPLE_AppDefined, - "Failed to compute polynomial equations of desired order\n" - "for provided control points." ); + CPLError( CE_Failure, CPLE_AppDefined, CRS_error_message[-nCRSresult] ); goto CleanupAfterError; }
Change History (3)
comment:2 by , 17 years ago
Swapnil, I applied the patch, with some minor modification to make sure it works on windows. Howard
Note:
See TracTickets
for help on using tickets.