else: sys.exit( textwrap.fill('SSURGO features already exist in project directory. Use --overwrite option to overwrite.') ) # Get study area parameters studyArea = GenericMetadata.readStudyAreaEntries(context) bbox = bboxFromString(studyArea['bbox_wgs84']) outputrasterresolutionX = studyArea['dem_res_x'] outputrasterresolutionY = studyArea['dem_res_y'] srs = studyArea['dem_srs'] sys.stdout.write('Downloading SSURGO features for study area from USDA Soil Data mart...\n') sys.stdout.flush() shpFilename = getMapunitFeaturesForBoundingBox(context.config, context.projectDir, bbox, tileBbox=args.tile, t_srs=srs, tileDivisor=args.tiledivisor, keepOriginals=args.keeporiginals, overwrite=args.overwrite, nprocesses=args.nprocesses) # Write provenance asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION) asset.name = 'soil_features' asset.dcIdentifier = shpFilename asset.dcSource = featurequery.WFS_URL asset.dcTitle = 'SSURGO soils data' asset.dcPublisher = 'USDA' asset.dcDescription = cmdline asset.writeToMetadata(context) # Write processing history GenericMetadata.appendProcessingHistoryItem(context, cmdline)
sys.stdout.flush() shpFilepath = os.path.join( context.projectDir, manifest['soil_features'] ) deleteShapefile(shpFilepath) else: sys.exit( textwrap.fill('SSURGO features already exist in project directory. Use --overwrite option to overwrite.') ) # Get study area parameters studyArea = GenericMetadata.readStudyAreaEntries(context) bbox = bboxFromString(studyArea['bbox_wgs84']) outputrasterresolutionX = studyArea['dem_res_x'] outputrasterresolutionY = studyArea['dem_res_y'] srs = studyArea['dem_srs'] sys.stdout.write('Downloading SSURGO features for study area from USDA Soil Data mart...\n') sys.stdout.flush() shpFilename = getMapunitFeaturesForBoundingBox(context.config, context.projectDir, bbox, t_srs=srs)[0] # Write provenance asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION) asset.name = 'soil_features' asset.dcIdentifier = shpFilename asset.dcSource = featurequery.WFS_URL asset.dcTitle = 'SSURGO soils data' asset.dcPublisher = 'USDA' asset.dcDescription = cmdline asset.writeToMetadata(context) # Write processing history GenericMetadata.appendProcessingHistoryItem(context, cmdline)
context = Context(args.projectDir, configFile) if not context.config.has_option('GDAL/OGR', 'PATH_OF_OGR2OGR'): sys.exit("Config file %s does not define option %s in section %s" & \ (args.configfile, 'GDAL/OGR', 'PATH_OF_OGR2OGR')) # Get study area parameters studyArea = GenericMetadata.readStudyAreaEntries(context) bbox = bboxFromString(studyArea['bbox_wgs84']) outputrasterresolutionX = studyArea['dem_res_x'] outputrasterresolutionY = studyArea['dem_res_y'] srs = studyArea['dem_srs'] gmlFilename = getMapunitFeaturesForBoundingBox(context.projectDir, bbox, mapunitExtended=True, tileBbox=False)[0] # Convert from gml to shp and then rasterize gmlFilepath = os.path.join(context.projectDir, gmlFilename) layerName = os.path.splitext(gmlFilename)[0] shpFilename = convertGMLToShapefile(context.config, context.projectDir, gmlFilepath, layerName, srs) # Write provenance asset = AssetProvenance(GenericMetadata.MANIFEST_SECTION) asset.name = 'soil_features' asset.dcIdentifier = shpFilename asset.dcSource = featurequery.WFS_URL asset.dcTitle = 'SSURGO soils data' asset.dcPublisher = 'USDA' asset.dcDescription = cmdline asset.writeToMetadata(context)