EcohydroLib  1.29
Functions | Variables
ecohydrolib.ssurgo.featurequery Namespace Reference

Make feature queries against USDA Soil Data Mart OGC web service interface. More...

Functions

def getMapunitFeaturesForBoundingBox
 

Variables

int MAX_SSURGO_EXTENT = 10100000000
 
float SSURGO_BBOX_TILE_DIVISOR = 8.0
 
int SSURGO_WFS_TIMEOUT_SEC = 3600
 
int SSURGO_GML_MAX_DOWNLOAD_ATTEMPTS = 4
 
string WFS_URL = 'http://SDMDataAccess.nrcs.usda.gov/Spatial/SDMWGS84Geographic.wfs'
 

Detailed Description

Make feature queries against USDA Soil Data Mart OGC web service interface.

This software is provided free of charge under the New BSD License. Please see the following license information:

Copyright (c) 2013, University of North Carolina at Chapel Hill All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Author
Brian Miles brian.nosp@m._mil.nosp@m.es@un.nosp@m.c.ed.nosp@m.u

Function Documentation

def ecohydrolib.ssurgo.featurequery.getMapunitFeaturesForBoundingBox (   config,
  outputDir,
  bbox,
  tileBbox = False,
  t_srs = 'EPSG:4326',
  tileDivisor = SSURGO_BBOX_TILE_DIVISOR,
  keepOriginals = False,
  overwrite = True,
  nprocesses = None 
)
Query USDA Soil Data Mart for SSURGO MapunitPolyExtended features with a given bounding box.
    Features will be written to one or more shapefiles, one file for each bboxTile tile,
    stored in the specified output directory. The filename will be returned as a string.
    Will fetch SSURGO tabular data (see ssurgolib.attributequery.ATTRIBUTE_LIST for a list
    of attributes) and join those data to the features in the final shapefiles(s).

    @note Will silently exit if features already exist.

    @param config onfigParser containing the section 'GDAL/OGR' and option 'PATH_OF_OGR2OGR'
    @param outputDir String representing the absolute/relative path of the directory into which features should be written
    @param bbox A dict containing keys: minX, minY, maxX, maxY, srs, where srs='EPSG:4326'
    @param tileBoundingBox True if bounding box should be tiled if extent exceeds featurequery.MAX_SSURGO_EXTENT
    @param t_srs String representing the spatial reference system of the output shapefiles, of the form 'EPSG:XXXX'
    @param tileDivisor Float representing amount by which to divide tile slides.
    @param keepOriginals Boolean, if True original feature layers will be retained (otherwise they will be deleted)
    @param overwrite Boolean, if True any existing files will be overwritten
    @param nprocesses Integer representing number of processes to use for fetching SSURGO tiles in parallel (used only if bounding box needs to be tiled).
           if None, multiprocessing.cpu_count() will be used.
    
    @return A list of strings representing the name of the shapefile(s) to which the mapunit features were saved.
    
    @exception IOError if output directory is not a directory
    @exception IOError if output directory is not writable
    @exception Exception if tileDivisor is not a postive float > 0.0.
    @exception Exception if bounding box area is greater than MAX_SSURGO_EXTENT
    @exception Exception if no MUKEYs were returned

Variable Documentation

float ecohydrolib.ssurgo.featurequery.MAX_SSURGO_EXTENT = 10100000000
float ecohydrolib.ssurgo.featurequery.SSURGO_BBOX_TILE_DIVISOR = 8.0
int ecohydrolib.ssurgo.featurequery.SSURGO_GML_MAX_DOWNLOAD_ATTEMPTS = 4
int ecohydrolib.ssurgo.featurequery.SSURGO_WFS_TIMEOUT_SEC = 3600
string ecohydrolib.ssurgo.featurequery.WFS_URL = 'http://SDMDataAccess.nrcs.usda.gov/Spatial/SDMWGS84Geographic.wfs'