예제 #1
0
  def encode(self, builder):
    builder.start("title", dict())
    builder.data(self.title)
    builder.end("title")

    if self.abstract is not None:
        builder.start("description", dict())
        builder.data(self.abstract)
        builder.end("description")

    builder.start("keywords", dict())
    for kw in self.keywords:
        builder.start("string", dict())
        builder.data(kw)
        builder.end("string")
    builder.end("keywords")

    if self.native_bbox is not None:
        builder.start("nativeBoundingBox", dict())
        bbox_xml(builder, self.native_bbox)
        builder.end("nativeBoundingBox")

    if self.latlon_bbox is not None:
        builder.start("latLonBoundingBox", dict())
        bbox_xml(builder, self.latlon_bbox)
        builder.end("latLonBoundingBox")

    builder.start("srs", dict())
    builder.data(self.projection)
    builder.end("srs")

    builder.start("enabled", dict())
    if self.enabled:
        builder.data("true")
    else:
        builder.data("false")
    builder.end("enabled")

    builder.start("metadata", dict())
    for k, v in self.extra_config.iteritems():
        builder.start("entry", {'key': k})
        builder.data(v)
        builder.end("entry")
    builder.end("metadata")

    builder.start("dimensions", dict())
    for dim in self.dimensions:
        coverage_dimension_xml(builder, dim)
    builder.end("dimensions")

    builder.start("nativeFormat", dict())
    builder.data(self.native_format)
    builder.end("nativeFormat")

    builder.start("supportedFormats", dict())
    for format in self.supported_formats:
        builder.start("string", dict())
        builder.data(format)
        builder.end("string")
    builder.end("supportedFormats")

    # TODO: Grid should probably be its own object type
    # builder.start("grid", {'dimension': '2'})
    # builder.data(self.grid)
    # builder.end("grid")

    if self.default_interpolation_method is not None:
        builder.start("defaultInterpolationMethod", dict())
        builder.data(self.default_interpolation_method)
        builder.end("defaultInterpolationMethod")

    builder.start("interpolationMethods", dict())
    for method in self.interpolation_methods:
        builder.start("string", dict())
        builder.data(method)
        builder.end("string")
    builder.end("interpolationMethods")

    builder.start("requestSRS", dict())
    builder.start("string", dict())
    builder.data(self.request_srs)
    builder.end("string")
    builder.end("requestSRS")

    builder.start("responseSRS", dict())
    builder.start("string", dict())
    builder.data(self.response_srs)
    builder.end("string")
    builder.end("responseSRS")

    builder.start("metadataLinks", dict())
    for link in self.metadata_links:
        mimetype, mdtype, url = link
        builder.start("metadataLink", dict())
        builder.start("type", dict())
        builder.data(mimetype)
        builder.end("type")
        builder.start("metadataType", dict())
        builder.data(mdtype)
        builder.end("metadataType")
        builder.start("content", dict())
        builder.data(url)
        builder.end("content")
        builder.end("metadataLink")
    builder.end("metadataLinks")
예제 #2
0
  def encode(self, builder):
    builder.start("name", dict())
    builder.data(self.name)
    builder.end("name")

    builder.start("title", dict())
    builder.data(self.title)
    builder.end("title")

    if self.abstract is not None:
        builder.start("abstract", dict())
        builder.data(self.abstract)
        builder.end("abstract")

    builder.start("keywords", dict())
    for kw in self.keywords:
        builder.start("string", dict())
        builder.data(kw)
        builder.end("string")
    builder.end("keywords")

    if self.native_bbox is not None:
        builder.start("nativeBoundingBox", dict())
        bbox_xml(builder, self.native_bbox)
        builder.end("nativeBoundingBox")

    if self.latlon_bbox is not None:
        builder.start("latLonBoundingBox", dict())
        bbox_xml(builder, self.latlon_bbox)
        builder.end("latLonBoundingBox")

    # builder.start("nativeCRS", {'class': 'projected'})
    # builder.data(self.native_crs)
    # builder.end("nativeCRS")

    builder.start("srs", dict())
    builder.data(self.projection)
    builder.end("srs")

    builder.start("enabled", dict())
    if self.enabled:
        builder.data("true")
    else:
        builder.data("false")
    builder.end("enabled")

    builder.start("metadata", dict())
    for k, v in self.extra_config.iteritems():
        builder.start("entry", {"key": k})
        builder.data(v)
        builder.end("entry")
    builder.end("metadata")

    builder.start("store", {"class": "coverageStore"})
    builder.start("name", dict())
    builder.data(self.store.name)
    builder.end("name")
    atom_link_xml(builder, self.store.href)
    builder.end("store")

    if self.projection_policy is not None:
        builder.start("projectionPolicy", dict())
        builder.data(self.projection_policy)
        builder.end("projectionPolicy")

    builder.start("metadataLinks", dict())
    for link in self.metadata_links:
        mimetype, mdtype, url = link
        builder.start("metadataLink", dict())
        builder.start("type", dict())
        builder.data(mimetype)
        builder.end("type")
        builder.start("metadataType", dict())
        builder.data(mdtype)
        builder.end("metadataType")
        builder.start("content", dict())
        builder.data(url)
        builder.end("content")
        builder.end("metadataLink")
    builder.end("metadataLinks")

    # builder.start("attributes")
    # for att in self.attributes:
    #     builder.start("attribute", dict())
    #     builder.start("name", dict())
    #     builder.data(att)
    #     builder.end("name")
    #     builder.end("attribute")
    # builder.end("attributes")
    

    """
    Removes a featureType from the GeoServer Catalog.  This is a dumb
    method, ie it does not remove any dependent resources in GeoServer. 
    To remove all dependent resource call delete_all
    """
    self.catalog.delete(self)