Exemple #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")]
Exemple #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")]