void OGRGeometry::dumpReadable( FILE * fp, const char * pszPrefix ) { char *pszWkt = NULL; if( pszPrefix == NULL ) pszPrefix = ""; if( exportToWkt( &pszWkt ) == OGRERR_NONE ) { fprintf( fp, "%s%s\n", pszPrefix, pszWkt ); CPLFree( pszWkt ); } }
OGRErr OGRSpatialReference::Validate() { /* -------------------------------------------------------------------- */ /* Validate root node. */ /* -------------------------------------------------------------------- */ if( poRoot == NULL ) { CPLDebug( "OGRSpatialReference::Validate", "No root pointer.\n" ); return OGRERR_CORRUPT_DATA; } OGRErr eErr = Validate(poRoot); /* Even if hand-validation has succeeded, try a more formal validation */ /* using the CT spec grammar */ static int bUseCTGrammar = -1; if( bUseCTGrammar < 0 ) bUseCTGrammar = CPLTestBool(CPLGetConfigOption("OSR_USE_CT_GRAMMAR", "TRUE")); if( eErr == OGRERR_NONE && bUseCTGrammar ) { osr_cs_wkt_parse_context sContext; char* pszWKT = NULL; exportToWkt(&pszWKT); sContext.pszInput = pszWKT; sContext.pszLastSuccess = pszWKT; sContext.pszNext = pszWKT; sContext.szErrorMsg[0] = '\0'; if( osr_cs_wkt_parse(&sContext) != 0 ) { CPLDebug( "OGRSpatialReference::Validate", "%s", sContext.szErrorMsg ); eErr = OGRERR_CORRUPT_DATA; } CPLFree(pszWKT); } return eErr; }