예제 #1
0
 def get_layer(self, name):
     try:
         lyr = Layer(self, name)
         lyr.fetch()
         return lyr
     except FailedRequestError:
         return None
예제 #2
0
 def get_layer(self, name):
     try:
         lyr = Layer(self, name)
         lyr.fetch()
         return lyr
     except FailedRequestError:
         return None
예제 #3
0
 def get_layers(self, resource=None):
     if isinstance(resource, basestring):
         resource = self.get_resource(resource)
     layers_url = url(self.service_url, ["layers.xml"])
     description = self.get_xml(layers_url)
     lyrs = [Layer(self, l.find("name").text) for l in description.findall("layer")]
     if resource is not None:
         lyrs = [l for l in lyrs if l.resource.href == resource.href]
     # TODO: Filter by style
     return lyrs
예제 #4
0
 def get_layers(self, resource=None):
     if isinstance(resource, basestring):
         resource = self.get_resources(names=resource)[0]
     layers_url = "{}/layers.xml".format(self.service_url)
     data = self.get_xml(layers_url)
     lyrs = [
         Layer(self,
               l.find("name").text) for l in data.findall("layer")
     ]
     if resource is not None:
         lyrs = [l for l in lyrs if l.resource.href == resource.href]
     # TODO: Filter by style
     return lyrs
예제 #5
0
    def get_layers(self, resource=None):
        if isinstance(resource, basestring):
            ws_name = None
            if self.get_short_version() >= "2.13":
                if ":" in resource:
                    ws_name, resource = resource.split(':')

            if ws_name:
                resources = self.get_resources(names=resource, workspaces=[ws_name])
            else:
                resources = self.get_resources(names=resource)
            resource = self._return_first_item(resources)
        layers_url = "{}/layers.xml".format(self.service_url)
        data = self.get_xml(layers_url)
        lyrs = [Layer(self, l.find("name").text) for l in data.findall("layer")]
        if resource is not None:
            lyrs = [l for l in lyrs if l.resource.href == resource.href]
        # TODO: Filter by style
        return lyrs