當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。