Example #1
0
class FeatureType(_ResourceBase):

    resource_type = "featureType"
    url_part_stores = 'datastores'
    url_part_types = 'featuretypes'

    title = xml_property("title")
    abstract = xml_property("abstract")
    enabled = xml_property("enabled")
    advertised = xml_property("advertised", default="true")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection = xml_property("srs")
    projection_policy = xml_property("projectionPolicy")
    keywords = xml_property("keywords", string_list)
    attributes = xml_property("attributes", attribute_list)
    metadata_links = xml_property("metadataLinks", metadata_link_list)

    writers = dict(name=write_string("name"),
                   title=write_string("title"),
                   abstract=write_string("abstract"),
                   enabled=write_bool("enabled"),
                   advertised=write_bool("advertised"),
                   nativeBoundingBox=write_bbox("nativeBoundingBox"),
                   latLonBoundingBox=write_bbox("latLonBoundingBox"),
                   srs=write_string("srs"),
                   nativeCRS=write_string("nativeCRS"),
                   projectionPolicy=write_string("projectionPolicy"),
                   keywords=write_string_list("keywords"),
                   metadataLinks=write_metadata_link_list("metadataLinks"))
Example #2
0
class Coverage(_ResourceBase):

    resource_type = "coverage"
    url_part_stores = 'coveragestores'
    url_part_types = 'coverages'

    title = xml_property("title")
    abstract = xml_property("abstract")
    enabled = xml_property("enabled")
    advertised = xml_property("advertised", default="true")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection = xml_property("srs")
    projection_policy = xml_property("projectionPolicy")
    keywords = xml_property("keywords", string_list)
    request_srs_list = xml_property("requestSRS", string_list)
    response_srs_list = xml_property("responseSRS", string_list)
    supported_formats = xml_property("supportedFormats", string_list)
    metadata_links = xml_property("metadataLinks", metadata_link_list)

    writers = dict(title=write_string("title"),
                   abstract=write_string("abstract"),
                   enabled=write_bool("enabled"),
                   advertised=write_bool("advertised"),
                   nativeBoundingBox=write_bbox("nativeBoundingBox"),
                   latLonBoundingBox=write_bbox("latLonBoundingBox"),
                   srs=write_string("srs"),
                   projection_policy=write_string("projectionPolicy"),
                   keywords=write_string_list("keywords"),
                   metadataLinks=write_metadata_link_list("metadataLinks"),
                   requestSRS=write_string_list("requestSRS"),
                   responseSRS=write_string_list("responseSRS"),
                   supportedFormats=write_string_list("supportedFormats"))
Example #3
0
class Coverage(_ResourceBase):

    resource_type = "coverage"
    url_part_stores = 'coveragestores'
    url_part_types = 'coverages'

    title = xml_property("title")
    native_name = xml_property("nativeName")
    native_format = xml_property("nativeFormat")
    native_crs = xml_property("nativeCRS")
    default_interpolation_method = xml_property("defaultInterpolationMethod")
    abstract = xml_property("abstract")
    description = xml_property("description")
    enabled = xml_property("enabled")
    advertised = xml_property("advertised", default="true")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection = xml_property("srs")
    projection_policy = xml_property("projectionPolicy")
    keywords = xml_property("keywords", string_list)
    request_srs_list = xml_property("requestSRS", string_list)
    response_srs_list = xml_property("responseSRS", string_list)
    supported_formats = xml_property("supportedFormats", string_list)
    metadata_links = xml_property("metadataLinks", metadata_link_list)
    metadata = xml_property("metadata", metadata)
    interpolation_methods = xml_property("interpolationMethods", string_list)

    writers = {
        'title': write_string("title"),
        'native_name': write_string("nativeName"),
        'native_format': write_string("nativeFormat"),
        'native_crs': write_string("nativeCRS"),
        'default_interpolation_method':
        write_string("defaultInterpolationMethod"),
        'description': write_string("description"),
        'abstract': write_string("abstract"),
        'enabled': write_bool("enabled"),
        'advertised': write_bool("advertised"),
        'nativeBoundingBox': write_bbox("nativeBoundingBox"),
        'latLonBoundingBox': write_bbox("latLonBoundingBox"),
        'srs': write_string("srs"),
        'projection_policy': write_string("projectionPolicy"),
        'keywords': write_string_list("keywords"),
        'metadataLinks': write_metadata_link_list("metadataLinks"),
        'requestSRS': write_string_list("requestSRS"),
        'responseSRS': write_string_list("responseSRS"),
        'supportedFormats': write_string_list("supportedFormats"),
        'interpolation_methods': write_string_list("interpolationMethods"),
        'metadata': write_metadata("metadata")
    }
Example #4
0
class WmsLayer(ResourceInfo):
    resource_type = "wmsLayer"
    save_method = settings.PUT

    def __init__(self, catalog, workspace, store, name):
        super(WmsLayer, self).__init__()
        self.catalog = catalog
        self.workspace = workspace
        self.store = store
        self.name = name

    @property
    def href(self):
        return urljoin(
            self.catalog.service_url,
            "workspaces/{}/wmsstores/{}/wmslayers/{}.xml".format(
                self.workspace.name,
                self.store.name,
                self.name
            )
        )

    title = xml_property("title")
    description = xml_property("description")
    abstract = xml_property("abstract")
    keywords = xml_property("keywords", string_list)
    # nativeCRS
    projection = xml_property("srs")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection_policy = xml_property("projectionPolicy")
    enabled = xml_property("enabled", lambda x: x.text == "true")
    advertised = xml_property("advertised", lambda x: x.text == "true",
                              default=True)
    metadata_links = xml_property("metadataLinks", metadata_link_list)

    writers = {
        'title': write_string("title"),
        'description': write_string("description"),
        'abstract': write_string("abstract"),
        'keywords': write_string_list("keywords"),
        # nativeCRS
        'srs': write_string("srs"),
        'nativeBoundingBox': write_bbox("nativeBoundingBox"),
        'latLonBoundingBox': write_bbox("latLonBoundingBox"),
        'projectionPolicy': write_string("projectionPolicy"),
        'enabled': write_bool("enabled"),
        'advertised': write_bool("advertised"),
        'metadataLinks': write_metadata_link_list("metadataLinks")
    }
Example #5
0
class WmsLayer(ResourceInfo):
    resource_type = "wmsLayer"
    save_method = "PUT"

    def __init__(self, catalog, workspace, store, name):
        super(WmsLayer, self).__init__()
        self.catalog = catalog
        self.workspace = workspace
        self.store = store
        self.name = name

    @property
    def href(self):
        return "%s/workspaces/%s/wmsstores/%s/wmslayers/%s.xml" % (
                self.catalog.service_url,
                self.workspace.name,
                self.store.name,
                self.name
                )


    title = xml_property("title")
    description = xml_property("description")
    abstract = xml_property("abstract")
    keywords = xml_property("keywords", string_list)
    # nativeCRS
    projection = xml_property("srs")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection_policy = xml_property("projectionPolicy")
    enabled = xml_property("enabled", lambda x: x.text == "true")
    advertised = xml_property("advertised", lambda x: x.text == "true", default=True)
    metadata_links = xml_property("metadataLinks", metadata_link_list)

    writers = dict(
                title = write_string("title"),
                description = write_string("description"),
                abstract = write_string("abstract"),
                keywords = write_string_list("keywords"),
                # nativeCRS
                projection = write_string("srs"),
                nativeBoundingBox = write_bbox("nativeBoundingBox"),
                latLonBoundingBox = write_bbox("latLonBoundingBox"),
                projection_policy = write_string("projectionPolicy"),
                enabled = write_bool("enabled"),
                advertised = write_bool("advertised"),
                metadataLinks = write_metadata_link_list("metadataLinks")
           )
Example #6
0
 def __init__(self, catalog, name, workspace=None):
     super(LayerGroup, self).__init__()
     assert isinstance(name, str)
     self.catalog = catalog
     self.name = name
     self.workspace = workspace
     # the XML format changed in 2.3.x - the element listing all the layers
     # and the entries themselves have changed
     if self.catalog.gsversion() == "2.2.x":
         parent, element, attributes = "layers", "layer", None
     else:
         parent = "publishables"
         element = "published"
         attributes = {'type': 'layer'}
     self._layer_parent = parent
     self._layer_element = element
     self._layer_attributes = attributes
     self.writers = {
         'name': write_string("name"),
         'styles': _write_styles,
         'layers':
         lambda b, l: _write_layers(b, l, parent, element, attributes),
         'bounds': write_bbox("bounds"),
         'workspace': write_string("workspace")
     }
Example #7
0
    def __init__(self, catalog, name, workspace=None):
        super(LayerGroup, self).__init__()

        assert isinstance(name, basestring)

        self.catalog = catalog
        self.name = name
        self.workspace = workspace

        # the XML format changed in 2.3.x - the element listing all the layers
        # and the entries themselves have changed
        if self.catalog.gsversion() == "2.2.x":
            parent, element, attributes = "layers", "layer", None
        else:
            parent, element, attributes = "publishables", "published", {'type':'layer'}
        self._layer_parent = parent
        self._layer_element = element
        self._layer_attributes = attributes
        self.writers = dict(
            name = write_string("name"),
            styles = _write_styles,
            layers = lambda b,l: _write_layers(b, l, parent, element, attributes),
            bounds = write_bbox("bounds"),
            workspace = write_string("workspace")
        )
Example #8
0
class LayerGroup(ResourceInfo):
    """
    Represents a layer group in geoserver 
    """

    resource_type = "layerGroup"
    save_method = "PUT"

    def __init__(self, catalog, name):
        super(LayerGroup, self).__init__()

        assert isinstance(name, basestring)

        self.catalog = catalog
        self.name = name

    @property
    def href(self):
        return url(self.catalog.service_url,
                   ["layergroups", self.name + ".xml"])

    styles = xml_property("styles", _style_list)
    layers = xml_property("layers", _layer_list)
    bounds = xml_property("bounds", bbox)

    writers = dict(name=write_string("name"),
                   styles=_write_styles,
                   layers=_write_layers,
                   bounds=write_bbox("bounds"))

    def __str__(self):
        return "<LayerGroup %s>" % self.name

    __repr__ = __str__
    def __init__(self, catalog, name, workspace=None):
        super(LayerGroup, self).__init__()

        assert isinstance(name, basestring)

        self.catalog = catalog
        self.name = name
        self.workspace = workspace

        # the XML format changed in 2.3.x - the element listing all the layers
        # and the entries themselves have changed
        if self.catalog.gsversion() == "2.2.x":
            parent, element, attributes = "layers", "layer", None
        else:
            parent, element, attributes = "publishables", "published", {
                'type': 'layer'
            }

        self._layer_parent = parent
        self._layer_element = element
        self._layer_attributes = attributes
        self.writers = dict(name=write_string("name"),
                            styles=_write_styles,
                            layers=lambda b, l: _write_layers(
                                b, l, parent, element, attributes),
                            bounds=write_bbox("bounds"),
                            workspace=write_string("workspace"),
                            mode=write_string("mode"),
                            abstractTxt=write_string("abstractTxt"),
                            title=write_string("title"))
Example #10
0
    def __init__(self, catalog, name):
        super(LayerGroup, self).__init__()

        assert isinstance(name, basestring)

        self.catalog = catalog
        self.name = name

        # the XML format changed in 2.3.x - the element listing all the layers
        # and the entries themselves have changed
        if self.catalog.gsversion() == "2.2.x":
            parent, element, attributes = "layers", "layer", None
        else:
            parent, element = "publishables", "published"
        self._layer_parent = parent
        self._layer_element = element
        self.writers = dict(
            name = write_string("name"),
            title = write_string("title"),
            abstract = write_string("abstractTxt"),
            mode = write_string("mode"),
            styles = _write_styles,
            layers = lambda b,l: _write_layers_mixed(b, l, parent, element),
            bounds = write_bbox("bounds")
        )
Example #11
0
class Coverage(ResourceInfo):
    def __init__(self, catalog, workspace, store, name):
        super(Coverage, self).__init__()
        self.catalog = catalog
        self.workspace = workspace
        self.store = store
        self.name = name

    @property
    def href(self):
        return url(self.catalog.service_url,
            ["workspaces", self.workspace.name,
             "coveragestores", self.store.name,
             "coverages", self.name + ".xml"])

    resource_type = "coverage"
    save_method = "PUT"

    title = xml_property("title")
    abstract = xml_property("abstract")
    enabled = xml_property("enabled")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection = xml_property("srs")
    projection_policy = xml_property("projectionPolicy")
    keywords = xml_property("keywords", string_list)
    request_srs_list = xml_property("requestSRS", string_list)
    response_srs_list = xml_property("responseSRS", string_list)
    supported_formats = xml_property("supportedFormats", string_list)
    metadata_links = xml_property("metadataLinks", metadata_link_list)

    writers = dict(
                title = write_string("title"),
                abstract = write_string("abstract"),
                enabled = write_bool("enabled"),
                nativeBoundingBox = write_bbox("nativeBoundingBox"),
                latLonBoundingBox = write_bbox("latLonBoundingBox"),
                srs = write_string("srs"),
                projection_policy = write_string("projectionPolicy"),
                keywords = write_string_list("keywords"),
                metadataLinks = write_metadata_link_list("metadataLinks"),
                requestSRS = write_string_list("requestSRS"),
                responseSRS = write_string_list("responseSRS"),
                supportedFormats = write_string_list("supportedFormats")
            )
Example #12
0
class FeatureType(ResourceInfo):
    resource_type = "featureType"
    save_method = "PUT"

    def __init__(self, catalog, workspace, store, name):
        super(FeatureType, self).__init__()

        assert isinstance(store, ResourceInfo)
        assert isinstance(name, basestring)

        self.catalog = catalog
        self.workspace = workspace
        self.store = store
        self.name = name

    @property
    def href(self):
        return url(self.catalog.service_url, [
            "workspaces", self.workspace.name, "datastores", self.store.name,
            "featuretypes", self.name + ".xml"
        ])

    title = xml_property("title")
    abstract = xml_property("abstract")
    enabled = xml_property("enabled")
    advertised = xml_property("advertised")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection = xml_property("srs")
    projection_policy = xml_property("projectionPolicy")
    keywords = xml_property("keywords", string_list)
    attributes = xml_property("attributes", attribute_list)
    metadata_links = xml_property("metadataLinks", metadata_link_list)

    writers = dict(title=write_string("title"),
                   abstract=write_string("abstract"),
                   enabled=write_bool("enabled"),
                   advertised=write_bool("advertised"),
                   nativeBoundingBox=write_bbox("nativeBoundingBox"),
                   latLonBoundingBox=write_bbox("latLonBoundingBox"),
                   srs=write_string("srs"),
                   projectionPolicy=write_string("projectionPolicy"),
                   keywords=write_string_list("keywords"),
                   metadataLinks=write_metadata_link_list("metadataLinks"))
Example #13
0
class LayerGroup(ResourceInfo):
    """
    Represents a layer group in geoserver 
    """

    resource_type = "layerGroup"
    save_method = "PUT"

    def __init__(self, catalog, name):
        super(LayerGroup, self).__init__()

        assert isinstance(name, basestring)

        self.catalog = catalog
        self.name = name

    @property
    def href(self):
        return url(self.catalog.service_url,
                   ["layergroups", self.name + ".xml"])

    styles = xml_property("styles", _style_list)
    bounds = xml_property("bounds", bbox)

    def _layers_getter(self):
        if self.catalog.gsversion() == "2.2.x":
            path, converter = "layers", _layer_list
        else:
            path, converter = "publishables", _publishable_list
        if path in self.dirty:
            return self.dirty[path]
        else:
            if self.dom is None:
                self.fetch()
            node = self.dom.find(path)
            return converter(self.dom.find(path)) if node is not None else None

    def _layers_setter(self, value):
        self.dirty["layers"] = value

    def _layers_delete(self):
        self.dirty["layers"] = None

    layers = property(_layers_getter, _layers_setter, _layers_delete)

    writers = dict(name=write_string("name"),
                   styles=_write_styles,
                   layers=_write_layers,
                   bounds=write_bbox("bounds"))

    def __str__(self):
        return "<LayerGroup %s>" % self.name

    __repr__ = __str__
Example #14
0
class FeatureType(_ResourceBase):

    resource_type = "featureType"
    url_part_stores = 'datastores'
    url_part_types = 'featuretypes'

    title = xml_property("title")
    native_name = xml_property("nativeName")
    abstract = xml_property("abstract")
    enabled = xml_property("enabled")
    advertised = xml_property("advertised", default="true")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection = xml_property("srs")
    projection_policy = xml_property("projectionPolicy")
    keywords = xml_property("keywords", string_list)
    attributes = xml_property("attributes", attribute_list)
    metadata_links = xml_property("metadataLinks", metadata_link_list)
    metadata = xml_property("metadata", metadata)
    cqlFilter = xml_property("cqlFilter")

    writers = {
        'name': write_string("name"),
        'nativeName': write_string("nativeName"),
        'title': write_string("title"),
        'abstract': write_string("abstract"),
        'enabled': write_bool("enabled"),
        'advertised': write_bool("advertised"),
        'nativeBoundingBox': write_bbox("nativeBoundingBox"),
        'latLonBoundingBox': write_bbox("latLonBoundingBox"),
        'srs': write_string("srs"),
        'nativeCRS': write_string("nativeCRS"),
        'projectionPolicy': write_string("projectionPolicy"),
        'keywords': write_string_list("keywords"),
        'metadataLinks': write_metadata_link_list("metadataLinks"),
        'metadata': write_metadata("metadata"),
        'cqlFilter': write_string('cqlFilter')
    }
Example #15
0
class FeatureType(_ResourceBase):

    resource_type = "featureType"
    url_part_stores = "datastores"
    url_part_types = "featuretypes"

    title = xml_property("title")
    native_name = xml_property("nativeName")
    abstract = xml_property("abstract")
    enabled = xml_property("enabled")
    advertised = xml_property("advertised", default="true")
    native_bbox = xml_property("nativeBoundingBox", bbox)
    latlon_bbox = xml_property("latLonBoundingBox", bbox)
    projection = xml_property("srs")
    projection_policy = xml_property("projectionPolicy")
    keywords = xml_property("keywords", string_list)
    attributes = xml_property("attributes", attribute_list)
    metadata_links = xml_property("metadataLinks", metadata_link_list)
    metadata = xml_property("metadata", metadata)

    writers = {
        "name": write_string("name"),
        "nativeName": write_string("nativeName"),
        "title": write_string("title"),
        "abstract": write_string("abstract"),
        "enabled": write_bool("enabled"),
        "advertised": write_bool("advertised"),
        "nativeBoundingBox": write_bbox("nativeBoundingBox"),
        "latLonBoundingBox": write_bbox("latLonBoundingBox"),
        "srs": write_string("srs"),
        "nativeCRS": write_string("nativeCRS"),
        "projectionPolicy": write_string("projectionPolicy"),
        "keywords": write_string_list("keywords"),
        "metadataLinks": write_metadata_link_list("metadataLinks"),
        "metadata": write_metadata("metadata"),
    }