def getLegendGraphic(self):
      if self.legend is None and not self.triedlegend:
        self.triedlegend = True
        layer = self.layer
        if "," in layer:
          layer = layer[layer.rindex(",") + 1:]
        if self.legendlayer: 
          layer = self.legendlayer
        url = self.baseurl + "?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&LAYER=%s&ext=.png" % (layer)
        try:
          print 'http://' + self.provider_host + url
          image = Loader.image('http://' + self.provider_host + url)
          self.legend = image
        except Exception, e:
          Logger.error('OverlayServer could not find LEGENDGRAPHICS for %s %s' % (self.baseurl, layer))
      return self.legend