当前位置: 首页>>代码示例>>Python>>正文


Python Service.get_tag方法代码示例

本文整理汇总了Python中Service.get_tag方法的典型用法代码示例。如果您正苦于以下问题:Python Service.get_tag方法的具体用法?Python Service.get_tag怎么用?Python Service.get_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service的用法示例。


在下文中一共展示了Service.get_tag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gather_capabilities

# 需要导入模块: import Service [as 别名]
# 或者: from Service import get_tag [as 别名]
def gather_capabilities(Nset, nameSet, cur, set_layers, list_WMSservers, server_URL):
  # Generated file name 
  name_file = nameSet + ".xml"
  
  # Product of an object class Document - dom
  dom = xml.dom.minidom.Document()
  
  # DTD schema takes one of the servers
  Nwms_dtd = list_WMSservers[0]

  # create service tag with need information (see Service.py).Return subtree dom
  tag_service = Service.get_tag(dom, server_URL, nameSet, Nwms_dtd)

  # create tag Capability.
  capability = dom.createElement("Capability")
  tag_service.appendChild(capability)
  
  # create tag in Capability: Request
  request_dom = dom.createElement("Request")
  capability.appendChild(request_dom)
  # Formated a tag Request with the intersection of all formats by all used servers
  request_dom = Service.get_tagRequest(dom, "GetCapabilities", request_dom,\
                                       server_URL, cur, list_WMSservers, nameSet, 0)
  request_dom = Service.get_tagRequest(dom, "GetMap", request_dom, server_URL,\
                                       cur, list_WMSservers, nameSet, 0)  
  request_dom = Service.get_tagRequest(dom, "GetFeatureInfo", request_dom, \
                                       server_URL, cur, list_WMSservers, nameSet, 0)  
  request_dom = Service.get_tagRequest(dom, "DescribeLayer", request_dom, \
                                       server_URL, cur, list_WMSservers, nameSet, 0)  
  request_dom = Service.get_tagRequest(dom, "GetLegendGraphic", request_dom, \
                                       server_URL, cur, list_WMSservers, nameSet, 0)  

  Nwms_used = -1
  count_servers = 0
  oldlist_formats = []
  for server_id in list_WMSservers:
  # Enumerates all used servers
    # Check their recurrence
    if Nwms_used == server_id:
      continue
    Nwms_used = server_id
    # Requested format of the tag with the name "Exception" of the server server_id
    # SELECT xpath_nodeset(Capabilites, '"//Capability/Exception/Format"') 
    # FROM WMSresources
    # WHERE Nwms = server_id;
    res = BD.interset_request(cur, "WMSresources", "Capabilites",\
                              "//Capability/Exception/Format", "Nwms", server_id)
    # Stores intersection list formats
    result = []
    if res:
    # If there is a format
      for tagFormat in res:
        strformat = tagFormat.replace("</Format>", "</Format>\n")
        if count_servers:
        # This is not the first list of formats
          oldlist_formats = list_formats
          # The string format is divided into a list
          list_formats = strformat.split("\n")
          # Created by the intersection of the lists of formats belonging to two servers
          for m in oldlist_formats:
            for j in list_formats:
              if m == j:
                result.append(m)
                break
          # The result of suppresion of record in the list of formats
          list_formats = result
        else:
        # This is the first list of formats
          # The string format is divided into a list
          list_formats = strformat.split("\n")
          count_servers += 1
  # Formed a string from the list of formats
  strformat = " "
  for k in list_formats:
    strformat = strformat + "%s\n\t"%k

  # Create tag "Exception"
  exception = dom.createElement("Exception")
  capability.appendChild(exception)
  except_format = dom.createTextNode("%s" % strformat)
  exception.appendChild(except_format)  

  count_servers = 0
  Nwms_used = -1
  oldlist_formats = " "
  for server_id in list_WMSservers:
  # Enumerates all used servers
    result = " "
    # Check their recurrence
    if Nwms_used == server_id:
      continue
    Nwms_used = server_id
    # Requested format of the tag with the name "Exception" of the server server_id
    # SELECT xpath_nodeset(Capabilites, '"//Capability/UserDefinedSymbolization"') 
    # FROM WMSresources
    # WHERE Nwms = server_id;
    res = BD.interset_request(cur, "WMSresources", "Capabilites",\
                              "//Capability/UserDefinedSymbolization",\
                              "Nwms", server_id)
    if res:
#.........这里部分代码省略.........
开发者ID:Jul1a,项目名称:wms-bot,代码行数:103,代码来源:parser_xml.py


注:本文中的Service.get_tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。