pyGDP = pyGDP.pyGDPwebProcessing() """ This example script calls into the geoserver to obtain the name of the shapefile 'sample:CONUS_States' sets up the proper inputs and submits a request into GDP. """ shapefiles = pyGDP.getShapefiles() print 'Available shapefiles: ' for shapefile in shapefiles: print shapefile print # Grab the file and get its attributes: shapefile = 'sample:CONUS_States' attributes = pyGDP.getAttributes(shapefile) for attr in attributes: print attr print # Grab the values from 'OBJECTID' and 'upload:OKCNTYD' usr_attribute = 'STATE' values = pyGDP.getValues(shapefile, usr_attribute) for v in values: print v print # our shapefile = 'upload:OKCNTYD', usr_attribute = 'OBJECTID', and usr_value = 13 # We get the dataset URI that we are interested in dataSetURIs = pyGDP.getDataSetURI() for d in dataSetURIs:
from __future__ import print_function import pyGDP ''' Shows GDP workflow in using specific values of attributes from a shapefile that already exists on the GDP server. ''' pyGDP = pyGDP.pyGDPwebProcessing() shapefiles = pyGDP.getShapefiles() print('Available shapefiles: ') for shapefile in shapefiles: print(shapefile) # Grab the file and get its attributes: shapefile = 'sample:CSC_Boundaries' attributes = pyGDP.getAttributes(shapefile) for attr in attributes: print(attr) # Grab the values from 'area_name' and 'sample:CSC_Boundaries' usr_attribute = 'area_name' values = pyGDP.getValues(shapefile, usr_attribute) for v in values: print(v) usr_value = 'Southwest' dataSetURI = 'dods://cida.usgs.gov/thredds/dodsC/gmo/GMO_w_meta.ncml' dataTypes = pyGDP.getDataType(dataSetURI) for d in dataTypes: print(d)
QA = False #if true, reset locations for services to QA servers filePath = '/Volumes/projects/WiLMA/LTER_donuts/' if QA: print 'using QA servers and services' pyGDP.WFS_URL = 'http://cida-wiwsc-gdp2qa.er.usgs.gov:8082/geoserver/wfs' pyGDP.upload_URL = 'http://cida-wiwsc-gdp2qa.er.usgs.gov:8082/geoserver' pyGDP.WPS_Service = 'http://cida.usgs.gov/qa/climate/gdp/utility/WebProcessingService' pyGDP.WPS_URL = 'http://cida.usgs.gov/qa/climate/gdp/process/WebProcessingService' # initialize pyGDP object pyGDP = pyGDP.pyGDPwebProcessing() for filename in os.listdir(filePath): try: shpfile = pyGDP.uploadShapeFile(filePath+filename), print 'successfully uploaded %r' % (shpfile) # get attributes att = pyGDP.getAttributes('%s' % (shpfile)) val = pyGDP.getValues('%s' % (shpfile),att[1]) for v in val: print '%s has attribute %s and value %s' % (shpfile,att[1],v) except Exception, msg: shpfile = filename[0:len(filename)-4] print '%s %s' % (shpfile,msg)