2024年1月31日发(作者:)
printf("tText (*.txt)n"); printf("tESRI Shapefile (*.shp)n"); printf("tKeyhold Markup Language (*.kml)n"); printf("nInput format and output format are determined automatically by file extension. n"); printf("If you use a shapefile as the output format, please additionally specifyn"); printf("point, line, or polygon output shapefile type.n");}int main(int argc, char * argv[]) { if (argc < 3) { usage(argv[0]); return 1; } OutputFormat * output = NULL;
InputFormat * input = NULL; struct stat fileExists; // Set up output std::string outFile = argv[2]; if (('.') == std::string::npos) { printf("I couldn't make sense of your output filename's extension: %s. Please use
, , or .n", argv[2]); return 1; } if ((('.')+1) == "txt") { printf("Setting up output file %s...n", argv[2]); output = new OutputFormatText(argv[2]); } else if ((('.')+1) == "shp") { if (argc < 4) { printf("When specifying shapefile output, please also specify 'point', 'line', or
'polygon'. See usage.n"); return 1; } std::string textAttributeFile = (0, ('.')) + "_"; OGRwkbGeometryType type; if (strcmp(argv[3], "line") == 0) { type = wkbLineString; } else if (strcmp(argv[3], "point") == 0) { type = wkbPoint; } else if (strcmp(argv[3], "polygon") == 0) { type = wkbPolygon; } else { printf("I didn't understand %s. Please use point, line, or polygon.n", argv[3]); return 1; } printf("Setting up output file %s...n", argv[2]); output = new OutputFormatSHP(argv[2], textAttributeFile.c_str(), (0,
('.')).c_str(), type); } else if ((('.')+1) == "kml") { printf("Setting up output file %s...n", argv[2]); output = new OutputFormatKML(argv[2], (0, ('.')).c_str()); } // Next grab the input file std::string inFile = argv[1]; if (('.') == std::string::npos) { printf("I couldn't make sense of your input filename's extension: %s. Please use
or .n", argv[1]); delete output;


发布评论