void create_xml_meta(char *inBaseName, char *outBaseName, input_format_t format_type) { meta_parameters *meta; if (format_type == CEOS) { asfPrintStatus(" Data format: CEOS\n\n"); meta = meta_read_only(inBaseName); meta_write_xml(meta, outBaseName); } else if (format_type == STF) { asfPrintStatus(" Data format: STF\n\n"); meta = meta_read_stf(inBaseName); meta_write_xml(meta, outBaseName); } else if (format_type == GENERIC_GEOTIFF) { asfPrintStatus(" Data format: GEOTIFF\n\n"); int ignore[MAX_BANDS], i; for (i=0; i<MAX_BANDS; i++) ignore[i]=0; meta = read_generic_geotiff_metadata(inBaseName, ignore, NULL); meta_write_xml(meta, outBaseName); } else if (format_type == BIL) { asfPrintStatus(" Data format: BIL\n\n"); meta = read_meta_bil(inBaseName); meta_write_xml(meta, outBaseName); } else if (format_type == GRIDFLOAT) { asfPrintStatus(" Data format: GRIDFLOAT\n\n"); meta = read_meta_gridfloat(inBaseName); meta_write_xml(meta, outBaseName); } else if (format_type == AIRSAR) { asfPrintStatus(" Data format: AIRSAR\n\n"); read_meta_airsar(inBaseName, outBaseName); } else if (format_type == UAVSAR) { asfPrintStatus(" Data format: UAVSAR\n\n"); read_meta_uavsar(inBaseName, outBaseName); } else if (format_type == VP) { } else if (format_type == JAXA_L0) { } else if (format_type == ALOS_MOSAIC) { } else if (format_type == TERRASAR) { } else if (format_type == RADARSAT2) { } else if (format_type == POLSARPRO) { } else if (format_type == GAMMA) { } else if (format_type == ROIPAC) { } }
int main(int argc, char **argv) { char meta_name[1024], xml_name[1024]; meta_parameters *meta=NULL; extern int currArg; /* from cla.h in asf.h... initialized to 1 */ logflag = 0; // Parse command line args while (currArg < (argc-2)) { char *key=argv[currArg++]; if (strmatch(key,"-log")) { sprintf(logFile, "%s", argv[currArg]); logflag = 1; } else { printf("\n ***Invalid option: %s\n\n", argv[currArg-1]); usage(argv[0]); } } if ((argc-currArg) < 2) { printf("Insufficient arguments.\n"); usage(argv[0]); } create_name(meta_name, argv[currArg], ".meta"); create_name(xml_name, argv[currArg+1], ".xml"); asfSplashScreen(argc, argv); meta = meta_read(meta_name); meta_write_xml(meta, xml_name); // Clean and report meta_free(meta); asfPrintStatus(" Converted metadata file (%s) to XML file (%s)\n\n", meta_name, xml_name); return 0; }