How to use the pywps.config.getConfigValue function in pywps

To help you get started, we’ve selected a few pywps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geopython / pywps / pywps / Wps / Execute.py View on Github external
self.mapObj.setMetaData("wfs_abstract", config.getConfigValue("wps","abstract"))
        self.mapObj.setMetaData("ows_keywordlist", config.getConfigValue("wps","keywords"))
        self.mapObj.setMetaData("ows_fees", config.getConfigValue("wps","fees"))
        self.mapObj.setMetaData("ows_accessconstraints", config.getConfigValue("wps","constraints"))
        self.mapObj.setMetaData("ows_contactorganization", config.getConfigValue("provider","providerName"))
        self.mapObj.setMetaData("ows_contactperson", config.getConfigValue("provider","individualName"))
        self.mapObj.setMetaData("ows_contactposition", config.getConfigValue("provider","positionName"))
        phone =  config.getConfigValue("provider","phoneVoice")
        if phone:
            self.mapObj.setMetaData("ows_contactvoicetelephone", config.getConfigValue("provider","phoneVoice"))
        phone = config.getConfigValue("provider","phoneFacsimile")
        if phone:
            self.mapObj.setMetaData("ows_contactfacsimiletelephone", config.getConfigValue("provider","phoneFacsimile"))
        self.mapObj.setMetaData("ows_address", config.getConfigValue("provider","deliveryPoint"))
        self.mapObj.setMetaData("ows_city", config.getConfigValue("provider","city"))
        self.mapObj.setMetaData("ows_country", config.getConfigValue("provider","country"))
        self.mapObj.setMetaData("ows_postcode", config.getConfigValue("provider","postalCode"))
        self.mapObj.setMetaData("ows_contactelectronicmailaddress", config.getConfigValue("provider","electronicMailAddress"))
        self.mapObj.setMetaData("ows_role", config.getConfigValue("provider","role"))

        self.mapFileName = os.path.join(config.getConfigValue("server","outputPath"),"wps"+str(self.pid)+".map")

        self.mapObj.setMetaData("wms_onlineresource",config.getConfigValue("mapserver","mapserveraddress")+"?map="+self.mapFileName)
github geopython / pywps / pywps / Wps / Execute / __init__.py View on Github external
dirs = os.listdir(tempPath)
        pyWPSDirs = 0
        for dir in dirs:
            if dir.find(TEMPDIRPREFIX) == 0:
                pyWPSDirs += 1

        if pyWPSDirs >= maxOperations and\
            maxOperations != 0:
            raise pywps.ServerBusy(value="Maximal number of permitted operations exceeded")

        # create temp dir
        self.workingDir = tempfile.mkdtemp(prefix=TEMPDIRPREFIX, dir=tempPath)

        self.workingDir = os.path.join(
                config.getConfigValue("server","tempPath"),self.workingDir)

        os.chdir(self.workingDir)
        self.dirsToBeRemoved.append(self.workingDir)

        # init GRASS
        try:
            if self.process.grassLocation:
                from pywps import Grass
                grass = Grass.Grass(self)
                if self.process.grassLocation == True:
                    self.process.grassMapset = grass.mkMapset()
                elif os.path.exists(os.path.join(config.getConfigValue("grass","gisdbase"),self.process.grassLocation)):
                    self.process.grassMapset = grass.mkMapset(self.process.grassLocation)
                else:
                    raise Exception("Location [%s] does not exist" % self.process.grassLocation)
        except Exception,e:
github ESGF / esgf-compute-wps / wps_cwt / processes / wps_uvcdat_utilities.py View on Github external
def importEnvironmentVariable( env_var ):
    try:
        value = config.getConfigValue( "cds", env_var )
    except:
        value = os.getenv( env_var )
    if value <> None:
        os.environ[ env_var ] = value
        logging.info("CDS environment variable %s set to %s" % ( env_var, value ) )
github geopython / pywps / pywps / Wps / Execute.py View on Github external
def _getMapServerWFS(self,output):
        """Get the URL for mapserver WFS request of the output"""
        import urllib2
        return urllib2.quote(config.getConfigValue("mapserver","mapserveraddress")+
                "?map="+self.mapFileName+
                "&SERVICE=WFS"+ "&REQUEST=GetFeature"+ "&VERSION=1.0.0"+
                "&TYPENAME="+output.identifier)
github geopython / pywps / pywps / Wps / GetCapabilities.py View on Github external
self.templateProcessor.set("providername",
                            config.getConfigValue("provider","providerName"))
        self.templateProcessor.set("individualname",
                        config.getConfigValue("provider","individualName"))
        self.templateProcessor.set("positionname",
                            config.getConfigValue("provider","positionName"))
        self.templateProcessor.set("providersite",
                            config.getConfigValue("provider","providerSite"))
        # phone
        if config.getConfigValue("provider","phoneVoice") or \
        config.getConfigValue("provider","phoneFacsimile"):
            self.templateProcessor.set("phone", 1)
            if config.getConfigValue("provider","phoneVoice"):
                self.templateProcessor.set("phonevoice",
                                    config.getConfigValue("provider","phoneVoice"))
            if config.getConfigValue("provider","phoneFacsimile"):
                self.templateProcessor.set("phonefacsimile",
                                    config.getConfigValue("provider","phoneFacsimile"))
        else:
            self.templateProcessor.set("phone", 0)

        # address
        if config.getConfigValue("provider","deliveryPoint") or \
           config.getConfigValue("provider","city") or \
           config.getConfigValue("provider","administrativeArea") or \
           config.getConfigValue("provider","postalCode") or \
           config.getConfigValue("provider","country") or \
           config.getConfigValue("provider","electronicMailAddress"):

            self.templateProcessor.set("address", 1)
            if config.getConfigValue("provider","deliveryPoint"):
                self.templateProcessor.set("deliverypoint",
github geopython / pywps / pywps / Wps / Execute / __init__.py View on Github external
self.workingDir = tempfile.mkdtemp(prefix=TEMPDIRPREFIX, dir=tempPath)

        self.workingDir = os.path.join(
                config.getConfigValue("server","tempPath"),self.workingDir)

        os.chdir(self.workingDir)
        self.dirsToBeRemoved.append(self.workingDir)

        # init GRASS
        try:
            if self.process.grassLocation:
                from pywps import Grass
                grass = Grass.Grass(self)
                if self.process.grassLocation == True:
                    self.process.grassMapset = grass.mkMapset()
                elif os.path.exists(os.path.join(config.getConfigValue("grass","gisdbase"),self.process.grassLocation)):
                    self.process.grassMapset = grass.mkMapset(self.process.grassLocation)
                else:
                    raise Exception("Location [%s] does not exist" % self.process.grassLocation)
        except Exception,e:
            self.cleanEnv()
            traceback.print_exc(file=pywps.logFile)
            raise pywps.NoApplicableCode("Could not init GRASS: %s" % e)

        return
github ESGF / esgf-compute-wps / compute / wps / processes / cdat / ensemble.py View on Github external
def __call__(self, data_manager, status):
        src = [data_manager.open(x) for x in self.input()]

        new_file_name = '%s.nc' % (str(uuid.uuid4()),)
        new_file_path = config.getConfigValue('server', 'outputPath', '/var/wps')
        new_file = os.path.join(new_file_path, new_file_name)

        fout = cdms2.open(new_file, 'w')

        target_grid = None

        gridder = self.parameter('gridder', required=False)

        if gridder:
            if isinstance(gridder.grid, esgf.Domain):
                target_grid = self._create_grid_from_domain(gridder.grid)
            elif isinstance(gridder.grid, esgf.Variable):
                with cdms2.open(gridder.grid.uri, 'r') as grid_file:
                    var = grid_file[gridder.grid.var_name]

                    target_grid = var.getGrid()
github geopython / pywps / pywps / Wps / Execute.py View on Github external
try:
            self.process = self.getProcess(self.wps.inputs["identifier"])
        except Exception, e:
            self.cleanEnv()
            raise pywps.InvalidParameterValue(
                    self.wps.inputs["identifier"])

        if not self.process:
            self.cleanEnv()
            raise pywps.InvalidParameterValue(
                    self.wps.inputs["identifier"])

        # set proper method for status change
        self.process.pywps = self.wps
        self.process.status.onStatusChanged = self.onStatusChanged
        self.process.debug = config.getConfigValue("server","debug")
        self.process.logFile = pywps.logFile
github geopython / pywps / pywps / Wps / Execute / UMN.py View on Github external
tmp = os.path.basename(tempfile.mkstemp()[1])
        self.outputs = {}
        self.process = process
        self.sessionId = sessId
        self.projs=self.getProjs()
        self.mapObj = mapObj()
        self.mapObj.setExtent(-180,-90,180,90)# irrelevant for WCS/WFS
        #self.mapObj.setProjection("+init=%s" % self.projs[0])
        self.mapObj.name = "%s-%s"%(self.process.identifier,self.sessionId)
        self.mapObj.setMetaData("ows_title", config.getConfigValue("wps","title"))
        self.mapObj.setMetaData("wms_abstract", config.getConfigValue("wps","abstract"))
        self.mapObj.setMetaData("wcs_abstract", config.getConfigValue("wps","abstract"))
        self.mapObj.setMetaData("wcs_label", process.title)
        self.mapObj.setMetaData("wfs_abstract", config.getConfigValue("wps","abstract"))
        self.mapObj.setMetaData("ows_keywordlist", config.getConfigValue("wps","keywords"))
        self.mapObj.setMetaData("ows_fees", config.getConfigValue("wps","fees"))
        self.mapObj.setMetaData("ows_accessconstraints", config.getConfigValue("wps","constraints"))
        self.mapObj.setMetaData("ows_contactorganization", config.getConfigValue("provider","providerName"))
        self.mapObj.setMetaData("ows_contactperson", config.getConfigValue("provider","individualName"))
        self.mapObj.setMetaData("ows_contactposition", config.getConfigValue("provider","positionName"))
        self.mapObj.setMetaData("ows_enable_request", "*")
        self.mapObj.debug = 5
        self.mapObj.setConfigOption("MS_ERRORFILE", "stderr")
        
        phone =  config.getConfigValue("provider","phoneVoice")
        if phone:
            self.mapObj.setMetaData("ows_contactvoicetelephone", config.getConfigValue("provider","phoneVoice"))
        phone = config.getConfigValue("provider","phoneFacsimile")
        if phone:
            self.mapObj.setMetaData("ows_contactfacsimiletelephone", config.getConfigValue("provider","phoneFacsimile"))
        self.mapObj.setMetaData("ows_address", config.getConfigValue("provider","deliveryPoint"))
        self.mapObj.setMetaData("ows_city", config.getConfigValue("provider","city"))
github geopython / pywps / pywps / Wps / DescribeProcess.py View on Github external
def __init__(self,wps,processes=None):
        """
        Arguments:
           self
           wps   - parent WPS instance
        """
        Request.__init__(self,wps,processes)

        #
        # HEAD
        #
        self.templateProcessor.set("encoding",
                                    config.getConfigValue("wps","encoding"))
        self.templateProcessor.set("lang",
                                    self.wps.inputs["language"])

        #
        # Processes
        #

        self.templateProcessor.set("Processes",self.processesDescription())
        self.response = self.templateProcessor.__str__()

        return