Ignore:
Timestamp:
08/06/09 16:05:04 (10 years ago)
Author:
domlowe
Message:

Legend added to cows client

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cowsclient/cowsclient/lib/wmc_util.py

    r5356 r5364  
    5353    response.headers['Content-Type'] = 'text/xml' 
    5454    response.write(wmcDoc) 
    55      
    5655 
    5756def GetLegend(self): 
    58     #not implemented yet 
    59     return None 
    60  
    61 #def GetLegend(self): 
    62 #    """ 
    63 #    Lookup a legend for a WMS map 
    64 #    NB, all required parameters are already included in the endpoint by this stage 
    65 #    """ 
    66 #    endpoint = self.inputs['ENDPOINT'] 
    67 #    if not endpoint: 
    68 #        raise exceptions.MissingParameterValue, "ENDPOINT parameter required" 
    69 #    log.info('Getting Legend from endpoint: ' + endpoint) 
    70 #    try: 
    71 #        req = urllib2.Request(endpoint,urllib.urlencode(request.params),{'Cookie': request.headers.get('Cookie', '')}) 
    72 #        filehandle = urllib2.urlopen(req) 
    73 #    except IOError: 
    74 #        raise exceptions.URLUnavailable, "Could not access WMC endpoint: %s" % endpoint 
    75 #    response.headers['Content-Type'] = 'text/xml' 
    76 #    response.write(filehandle.read()) 
     57    """ 
     58    Lookup a legend for a WMS map 
     59    NB, all required parameters are already included in the endpoint by this stage 
     60    """ 
     61    endpoint = self.inputs['ENDPOINT'] 
     62    if not endpoint: 
     63        raise exceptions.MissingParameterValue, "ENDPOINT parameter required" 
     64    try: 
     65        req = urllib2.Request(endpoint,urllib.urlencode(request.params),{'Cookie': request.headers.get('Cookie', '')}) 
     66        filehandle = urllib2.urlopen(req) 
     67    except IOError: 
     68        raise exceptions.URLUnavailable, "Could not access WMC endpoint: %s" % endpoint 
     69    response.headers['Content-Type'] = 'image/gif' 
     70    c.legendurl = endpoint 
     71    response.write(render('legendRender')) 
     72     
    7773     
    7874def RetrieveWebMapContext(self, endpoint): 
Note: See TracChangeset for help on using the changeset viewer.