Exemplo n.º 1
0
  def update(self):
    ResourceInfo.update(self)
    title = self.metadata.find("title")
    abstract = self.metadata.find("abstract")
    keywords = self.metadata.findall("keywords/string")
    projection = self.metadata.find("srs")
    projection_policy = self.metadata.find("projectionPolicy")
    enabled = self.metadata.find("enabled")
    md_links = self.metadata.findall("metadataLinks/metadataLink")

    self.title = title.text if title is not None else None
    self.abstract = abstract.text if abstract is not None else None
    self.projection = projection.text if projection is not None else None

    if projection_policy is not None and projection_policy.text in [REPROJECT, FORCE_NATIVE, FORCE_DECLARED]:
        self.projection_policy = projection_policy.text
    else:
        self.projection_policy = None

    if enabled is not None and enabled.text == "true":
        self.enabled = True
    else: 
        self.enabled = False

    self.keywords = [(word.text or "") for word in keywords]
    self.latlon_bbox = bbox(self.metadata.find("latLonBoundingBox"))
    self.native_bbox = bbox(self.metadata.find("nativeBoundingBox"))
    self.extra_config = dict((entry.attrib["key"], entry.text) for entry in self.metadata.findall("metadata/entry"))
    self.attributes = [att.text for att in self.metadata.findall("attributes/attribute/name")]
    self.metadata_links = [md_link(n) for n in self.metadata.findall("metadataLinks/metadataLink")]
Exemplo n.º 2
0
  def update(self):
    ResourceInfo.update(self)
    doc = self.metadata
    title = doc.find("title")
    abstract = doc.find("description")
    projection = doc.find("srs")
    enabled = doc.find("enabled")
    native_format = doc.find("nativeFormat")
    default_interpolation_method = doc.find("defaultInterpolationMethod")
    request_srs = doc.find("requestSRS/string")
    response_srs = doc.find("responseSRS/string")

    if title is None:
        print self.href
        print tostring(doc)

    self.title = title.text if title is not None else None
    self.abstract = abstract.text if abstract is not None else None
    self.keywords = [(kw.text or None) for kw in doc.findall("keywords/string")]
    self.native_bbox = bbox(doc.find("nativeBoundingBox"))
    self.latlon_bbox = bbox(doc.find("latLonBoundingBox"))
    self.projection = projection.text if projection is not None else None
    self.enabled = enabled.text == "true" if enabled is not None else False
    self.extra_config = dict((entry.attrib['key'], entry.text) for entry in doc.findall("metadata/entry"))
    self.dimensions = [coverage_dimension(d) for d in doc.findall("dimensions/coverageDimension")]
    self.native_format = native_format.text if native_format is not None else None
    self.grid = None # TODO: i guess this merits a little class of its own
    self.supported_formats = [format.text for format in doc.findall("supportedFormats/string")]
    self.default_interpolation_method = default_interpolation_method.text if default_interpolation_method is not None else None
    self.interpolation_methods = [method.text for method in doc.findall("interpolationMethods/string")]
    self.request_srs = request_srs.text if request_srs is not None else None
    self.response_srs = response_srs.text if response_srs is not None else None
    self.metadata_links = [md_link(n) for n in self.metadata.findall("metadataLinks/metadataLink")]
Exemplo n.º 3
0
  def update(self):
    ResourceInfo.update(self)
    name = self.metadata.find("name")
    attribution = self.metadata.find("attribution")
    enabled = self.metadata.find("enabled")
    default_style = self.metadata.find("defaultStyle")
    styles = self.metadata.findall("styles/style")

    self.name = name.text if name is not None else name
    
    if attribution is not None:
      title = attribution.find("title")
      href = attribution.find("href")
      logo_url = attribution.find("logoURL")
      logo_width = attribution.find("logoWidth")
      logo_height = attribution.find("logoHeight")
      logo_type = attribution.find("logoType")

      self.attribution = title.text if title is not None else None
      self.attribution_link = href.text if href is not None else None
      self.attribution_logo = logo_url.text if logo_url is not None else None
      self.attribution_type = logo_type.text if None not in [logo_url, logo_type] else None

      if None not in [logo_url, logo_width, logo_height]:
        self.attribution_size = (int(logo_width.text), int(logo_height.text))
      else:
        self.attribution_size = None

    else:
        self.attribution = None
        self.attribution_logo = None
        self.attribution_link = None
        self.attribution_size = None
        self.attribution_type = None

    if enabled is not None and enabled.text == "true":
        self.enabled = True
    else:
        self.enabled = False

    if default_style is not None:
        self.default_style = Style(self.catalog, default_style)
    else:
        self.default_style = None

    self.styles = [Style(self.catalog, s) for s in styles]

    resource = self.metadata.find("resource")
    if resource and "class" in resource.attrib:
        if resource.attrib["class"] == "featureType":
            self.resource = FeatureType(self.catalog, resource)
        elif resource.attrib["class"] == "coverage":
            self.resource = Coverage(self.catalog, resource)
Exemplo n.º 4
0
    def update(self):
        ResourceInfo.update(self)
        enabled = self.metadata.find("enabled")
        ws = self.metadata.find("workspace")
        connection_parameters = self.metadata.findall("connectionParameters/entry")
        feature_types = self.metadata.find("featureTypes")

        if enabled is not None and enabled.text == "true":
            self.enabled = True

        self.workspace = workspace.Workspace(self.catalog, ws) if ws is not None else None
        self.connection_parameters = dict((entry.attrib['key'], entry.text) for entry in connection_parameters) 
        self.featuretypelist_url = atom_link(feature_types)
Exemplo n.º 5
0
    def update(self):
        ResourceInfo.update(self)

        enabled = self.metadata.find("enabled")
        datastores = self.metadata.find("dataStores")
        coveragestores = self.metadata.find("coverageStores")

        if enabled is not None and enabled.text == 'true':
            enabled = True
        else:
            enabled = False

        self.datastore_url = atom_link(datastores)
        self.coveragestore_url = atom_link(coveragestores)
Exemplo n.º 6
0
    def update(self):
        ResourceInfo.update(self)
        type = self.metadata.find('type')
        enabled = self.metadata.find('enabled')
        ws = self.metadata.find('workspace')
        data_url = self.metadata.find('url')
        coverages = self.metadata.find('coverages')

        if enabled is not None and enabled.text == 'true':
            self.enabled = True
        else:
            self.enabled = False

        self.type = type.text if type is not None else None
        self.workspace = workspace.Workspace(self.catalog, ws) if ws is not None else None
        self.data_url = data_url.text if data_url is not None else None
        self.coveragelist_url = atom_link(coverages)
Exemplo n.º 7
0
 def update(self): 
     ResourceInfo.update(self)
     self.name = self.metadata.find("name").text
     self.layers = [ Layer(self.catalog,x) for x in self.metadata.findall("layers/layer")] 
     self.styles = self.metadata.find("styles/style")
     self.bounds = self.metadata.find("bounds") 
Exemplo n.º 8
0
 def update(self):
     ResourceInfo.update(self)
     self.name = self.metadata.find("name").text
     self.filename = self.metadata.find("filename").text