本文整理汇总了Python中pywps.config.getConfigValue函数的典型用法代码示例。如果您正苦于以下问题:Python getConfigValue函数的具体用法?Python getConfigValue怎么用?Python getConfigValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getConfigValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: formatMetadata
def formatMetadata(self,process):
"""Create structure suitble for template form process.metadata
:param process: :attr:`pywps.Process`
:returns: hash with formated metadata
"""
metadata = process.metadata
if type(metadata) == type({}):
metadata = [metadata]
metadatas = []
for metad in metadata:
metaStructure = {}
if metad.has_key("title"):
metaStructure["title"] = metad["title"]
else:
metaStructure["title"] = process.title
if metad.has_key("href"):
metaStructure["href"] = metad["href"]
else:
metaStructure["href"] = config.getConfigValue("wps","serveraddress")+\
"?service=WPS&request=DescribeProcess&version="+config.getConfigValue("wps","version")+\
"&identifier="+ process.identifier
metadatas.append(metaStructure)
return metadatas
示例2: formatMetadata
def formatMetadata(self, process):
"""Create structure suitble for template form process.metadata
:param process: :attr:`pywps.Process`
:returns: hash with formated metadata
"""
metadata = process.metadata
if isinstance(metadata, dict):
metadata = [metadata]
metadatas = []
for metad in metadata:
meta_structure = {}
if "title" in metad.keys():
meta_structure["title"] = metad["title"]
else:
meta_structure["title"] = process.title
if "href" in metad.keys():
meta_structure["href"] = metad["href"]
else:
meta_structure["href"] = (
config.getConfigValue("wps", "serveraddress") +
"?service=WPS&request=DescribeProcess&version=" +
config.getConfigValue("wps", "version") +
"&identifier=" +
process.identifier
)
metadatas.append(meta_structure)
return metadatas
示例3: __init__
def __init__(self,executeRequest):
""" Initialization of GRASS environmental variables (except GISRC). """
self.executeRequest = executeRequest
self.wps = self.executeRequest.wps
self.envs = {
"path":"PATH",
"addonPath":"GRASS_ADDON_PATH",
"version":"GRASS_VERSION",
"gui":"GRASS_GUI",
"gisbase": "GISBASE",
"ldLibraryPath": "LD_LIBRARY_PATH"
}
# put env
for key in self.envs.keys():
try:
self.setEnv(self.envs[key],config.getConfigValue("grass",key))
logging.info("GRASS environment variable %s set to %s" %\
(key, config.getConfigValue("grass",key)))
except :
logging.info("GRASS environment variable %s set to %s" %\
(key, self.envs[key]))
pass
# GIS_LOCK
self.setEnv('GIS_LOCK',str(os.getpid()))
logging.info("GRASS GIS_LOCK set to %s" % str(os.getpid()))
示例4: __init__
def __init__(self,process,sessId):
tmp = os.path.basename(tempfile.mkstemp()[1])
self.outputs = {}
self.process = process
self.sessionId = sessId
self.project = QgsProject.instance()
self.projectFileName = os.path.join(config.getConfigValue("server","outputPath"),self.sessionId+".qgs")
self.project.writePath( self.projectFileName )
self.project.setTitle( "%s-%s"%(self.process.identifier,self.sessionId) )
self.project.writeEntry("WMSServiceCapabilities", "/", True)
self.project.writeEntry("WMSServiceTitle", "/", config.getConfigValue("wps","title"))
self.project.writeEntry("WMSServiceAbstract", "/", config.getConfigValue("wps","abstract"))
self.project.writeEntry("WMSKeywordList", "/", config.getConfigValue("wps","keywords"))
self.project.writeEntry("WMSFees", "/", config.getConfigValue("wps","fees"))
self.project.writeEntry("WMSAccessConstraints", "/", config.getConfigValue("wps","constraints"))
self.project.writeEntry("WMSContactOrganization", "/", config.getConfigValue("provider","providerName"))
self.project.writeEntry("WMSContactPerson", "/", config.getConfigValue("provider","individualName"))
self.project.writeEntry("WMSContactPhone", "/", config.getConfigValue("provider","phoneVoice"))
self.project.writeEntry("WMSContactPhone", "/", config.getConfigValue("provider","electronicMailAddress"))
self.project.write( QFileInfo( self.projectFileName ) )
示例5: getCapabilities
def getCapabilities(self,output):
"""Get the URL for qgis-server GetCapapbilities request of the output"""
if output.format["mimetype"] == 'application/x-ogc-wms':
return config.getConfigValue("qgis","qgisserveraddress")+"?map="+self.projectFileName+"&SERVICE=WMS"+ "&REQUEST=GetCapabilities"
elif output.format["mimetype"] == 'application/x-ogc-wfs':
return config.getConfigValue("qgis","qgisserveraddress")+"?map="+self.projectFileName+"&SERVICE=WFS"+ "&REQUEST=GetCapabilities"
elif output.format["mimetype"] == 'application/x-ogc-wcs':
return config.getConfigValue("qgis","qgisserveraddress")+"?map="+self.projectFileName+"&SERVICE=WCS"+ "&REQUEST=GetCapabilities"
else:
return config.getConfigValue("qgis","qgisserveraddress")+"?map="+self.projectFileName+"&SERVICE=WMS"+ "&REQUEST=GetCapabilities"
示例6: __init__
def __init__(self, process, sessId):
MapServer.__init__(self, process, sessId)
# initial myself
# the catagory of this geoserver
self.cat = Catalog( '/'.join( (config.getConfigValue('geoserver', 'geoserveraddress'), 'rest') ),
config.getConfigValue('geoserver', 'admin'),
config.getConfigValue('geoserver', 'adminpassword') )
# get the workspace that datas will be saved and if workspace not set at configure file or
# not exit then the default workspace will be used
self.workspace = self.cat.get_workspace ( config.getConfigValue('geoserver', 'workspace') )
if not self.workspace:
self.workspace = self.cat.get_default_workspace()
示例7: _asReferenceOutput
def _asReferenceOutput(self, templateOutput, output):
# copy the file to output directory
# literal value
if output.type == "LiteralValue":
tmp = tempfile.mkstemp(
prefix="%s-%s" % (output.identifier, self.pid),
dir=os.path.join(config.getConfigValue("server", "outputPath")),
text=True,
)
f = open(tmp[1], "w")
f.write(str(output.value))
f.close()
templateOutput["reference"] = escape(tmp[1])
# complex value
else:
outName = os.path.basename(output.value)
outSuffix = os.path.splitext(outName)[1]
tmp = tempfile.mkstemp(
suffix=outSuffix,
prefix="%s-%s" % (output.identifier, self.pid),
dir=os.path.join(config.getConfigValue("server", "outputPath")),
text=True,
)
outFile = tmp[1]
outName = os.path.basename(outFile)
if not self._samefile(output.value, outFile):
COPY(os.path.abspath(output.value), outFile)
templateOutput["reference"] = escape(config.getConfigValue("server", "outputUrl") + "/" + outName)
output.value = outFile
# mapscript supported and the mapserver should be used for this
# output
# redefine the output
# Mapserver needs the format information, therefore checkMimeType has to be called before
self.checkMimeTypeOutput(output)
if self.umn and output.useMapscript:
owsreference = self.umn.getReference(output)
if owsreference:
templateOutput["reference"] = escape(owsreference)
templateOutput["mimetype"] = output.format["mimetype"]
templateOutput["schema"] = output.format["schema"]
templateOutput["encoding"] = output.format["encoding"]
return templateOutput
示例8: outputUrl_path
def outputUrl_path():
try:
outputUrl = wpsconfig.getConfigValue("server", "outputUrl")
except:
outputUrl = None
logger.warn('no outputUrl configured')
return outputUrl
示例9: www_url
def www_url():
try:
url = wpsconfig.getConfigValue("flyingpigeon", "www_url")
except:
url = None
logger.warn('no www-url configured')
return url
示例10: setValue
def setValue(self, value):
"""Set the output value
:param value: value to be returned (file name or file itself)
:type value: string or file
"""
#Note: cStringIO and StringIO are totally messed up, StringIO is type instance, cString is type cStringIO.StringO
#Better to also use __class__.__name__ to be certain what is is
# StringIO => StringIO but cStringIO => StringO
if type(value) == types.StringType or type(value)==types.UnicodeType:
self.value = value
elif type(value) == types.FileType:
self.value = value.name
elif value.__class__.__name__=='StringIO' or value.__class__.__name__=='StringO':
from pywps import config
fh, stringIOName = tempfile.mkstemp(prefix="%s-" % self.identifier,
dir=config.getConfigValue("server","outputPath"))
os.write(fh, value.getvalue())
os.close(fh)
self.value=stringIOName
# TODO add more types, like Arrays and lists for example
else:
raise Exception("Output type '%s' of '%s' output not known, not FileName, File or (c)StringIO object" %\
(type(value),self.identifier))
示例11: save
def save(self, output):
MapServer.save(self,output)
name = "%s-%s-%s"%(output.identifier, self.process.identifier,self.sessId)
service_url = '/'.join([config.getConfigValue('geoserver', 'geoserveraddress'), self.workspace.name])
if self.datatype == "raster":
# save
logging.info("upload raster file with name: {0} ".format(name))
self.cat.create_coveragestore(name, output.value, self.workspace, False)
# construct the wcs url
return urllib2.quote('/'.join( (service_url, 'wcs') ) +
"?SERVICE=WCS"+ "&REQUEST=GetCoverage"+ "&VERSION=1.0.0"+
"&COVERAGE="+name+"&CRS="+output.projection+
"&BBOX=%s,%s,%s,%s"%(output.bbox[0],output.bbox[1],output.bbox[2],output.bbox[3])+
"&HEIGHT=%s" %(output.height)+"&WIDTH=%s"%(output.width)+"&FORMAT=%s"%output.format["mimetype"])
elif self.datatype == "vector":
#save
logging.info("upload vector file with name: {0} ".format(name))
zip_shpf,lyname = self.compressFeatureData(output.value)
self.cat.create_featurestore(name, zip_shpf, self.workspace, False)
# construct the wfs url
return urllib2.quote('/'.join( (service_url, 'wfs') ) +
"?SERVICE=WFS"+ "&REQUEST=GetFeature"+ "&VERSION=1.0.0"+
"&TYPENAME="+lyname)
else:
return None
示例12: __init__
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
示例13: setRawData
def setRawData(self):
"""Sets response and contentType
"""
output = self.process.outputs[self.rawDataOutput]
if output.type == "LiteralValue":
self.contentType = "text/plain"
self.response = output.value
elif output.type == "ComplexValue":
# self.checkMimeTypeIn(output)
# copy the file to safe place
outName = os.path.basename(output.value)
outSuffix = os.path.splitext(outName)[1]
tmp = tempfile.mkstemp(
suffix=outSuffix,
prefix="%s-%s" % (output.identifier, self.pid),
dir=os.path.join(config.getConfigValue("server", "outputPath")),
)
outFile = tmp[1]
if not self._samefile(output.value, outFile):
COPY(os.path.abspath(output.value), outFile)
# check
self.contentType = output.format["mimetype"]
self.response = open(outFile, "rb")
示例14: output_path
def output_path():
try:
output_path = wpsconfig.getConfigValue("server", "outputPath")
except:
output_path = None
logger.warn('no output path configured')
return output_path
示例15: cache_path
def cache_path():
cache_path = None
try:
cache_path = wpsconfig.getConfigValue("cache", "cache_path")
except:
logger.warn("No cache path configured. Using default value.")
cache_path = os.path.join(os.sep, "tmp", "cache")
return cache_path