def initFromGetCapabilities(self, host, baseurl, layer=None, index=0, srs=None):
      self.debug = (layer == None) and (index == 0)
      # GetCapabilities (Layers + SRS)
      if layer is None or srs is None:
        capabilities = urlopen(host + baseurl + "?SERVICE=WMS&VERSION=1.1.1&Request=GetCapabilities").read().strip()
        try:
            tree = ET.fromstring(capabilities)
            if self.debug:
              ET.dump(tree)
            layers = tree.findall("Capability/Layer")  # TODO: proper parsing of cascading layers and their SRS
            data = {}
            for l in layers:
              self.parseLayer(l, data)