Exemple #1
0
 def GET(self, map_name, ws_name, format):
     mf, ws = get_mapfile_workspace(map_name, ws_name)
     return {"workspace": ({
                 "name": ws.name,
                 "dataStores":
                     href("%s/maps/%s/workspaces/%s/datastores.%s" % (web.ctx.home, map_name, ws.name, format)),
                 "coverageStores":
                     href("%s/maps/%s/workspaces/%s/coveragestores.%s" % (web.ctx.home, map_name, ws.name, format)),
                 "wmsStores": "", # TODO
                 })
             }
Exemple #2
0
    def GET(self, ws_name, format):
        """Return workspace <ws>."""

        ws = get_workspace(ws_name)
        return {"workspace": ({
                    "name": ws.name,
                    "dataStores":
                        href("%s/workspaces/%s/datastores.%s" % (web.ctx.home, ws.name, format)),
                    "coverageStores":
                        href("%s/workspaces/%s/coveragestores.%s" % (web.ctx.home, ws.name, format)),
                    })
                }
Exemple #3
0
 def GET(self, format):
     return {
         "about/version": href("about/version"),
         "workspaces": href("workspaces"),
         "styles": href("styles"),
         "layers": href("layers"),
         "layergroups": href("layergroups"),
         "services/wms/settings": href("services/wms/settings"),
         "services/wcs/settings": href("services/wcs/settings"),
         "services/wfs/settings": href("services/wfs/settings"),
         "fonts": href("fonts"),
         }
Exemple #4
0
    def GET(self, ws_name, cs_name, format):
        """Return coverage store <cs>."""

        ws = get_workspace(ws_name)
        with webapp.mightNotFound("coverageStore", workspace=ws_name):
            info = ws.get_coveragestore_info(cs_name)
        connectionParameters = info.get("connectionParameters", {})

        return {"coverageStore": {
                    "name": info["name"],
                    "enabled": True, # Always enabled
                                     # TODO: Handle enabled/disabled states
                    "workspace": {
                        "name": ws.name,
                        "href": "%s/workspaces/%s.%s" % (
                            web.ctx.home, ws.name, format),
                        },
                    "coverages": href("%s/workspaces/%s/coveragestores/%s/coverages.%s" % (
                                    web.ctx.home, ws.name, cs_name, format)
                        ),
                    "connectionParameters": connectionParameters and Entries({
                        "url": info["connectionParameters"]["url"],
                        # "namespace": None, # TODO
                        }, tag_name="entry"),
                    # TODO: type
                    }
                }
Exemple #5
0
    def GET(self, map_name, ws_name, cs_name, format):
        mf, ws = get_mapfile_workspace(map_name, ws_name)

        with webapp.mightNotFound("coverageStore", workspace=ws_name):
            info = ws.get_coveragestore_info(cs_name)

        return {"coverageStore": {
                    "name": info["name"],
                    "type": None, # TODO
                    "enabled": True, # TODO
                    "__default": False, # TODO
                    "workspace": {
                        "name": ws.name,
                        "href": "%s/maps/%s/workspaces/%s.%s" % (
                            web.ctx.home, map_name, ws.name, format),
                        },
                    "coverages": href("%s/maps/%s/workspaces/%s/coveragestores/%s/coverages.%s" % (
                                    web.ctx.home, map_name, ws.name, cs_name, format)
                        ),
                    "connectionParameters": Entries({
                        "url": info["connectionParameters"]["url"],
                        "namespace": None, # TODO
                        }, tag_name="entry")
                    }
                }
Exemple #6
0
    def GET(self, map_name, format, *args, **kwargs):

        mf = get_mapfile(map_name)
        with open(mf.path, "r") as f:
            data = f.read()
        return {"mapfile": ({
                "name": map_name,
                "href": "%s/maps/%s.map" % (web.ctx.home, map_name),
                "workspaces": href("%s/maps/%s/workspaces.%s" % (web.ctx.home, map_name, format)),
                "layers": href("%s/maps/%s/layers.%s" % (web.ctx.home, map_name, format)),
                "layergroups": href("%s/maps/%s/layergroups.%s" % (web.ctx.home, map_name, format)),
                "styles": href("%s/maps/%s/styles.%s" % (web.ctx.home, map_name, format)),
                "wms_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WMS" % (
                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wms_version"])),
                "wfs_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WFS" % (
                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wfs_version"])),
                "wcs_capabilities": href("%smap=%s&REQUEST=GetCapabilities&VERSION=%s&SERVICE=WCS" % (
                            get_config("mapserver")["url"], mf.path, get_config("mapserver")["wcs_version"])),
                    })
            } if format != "map" else data
Exemple #7
0
    def GET(self, ws_name, ds_name, format):
        """Return data store <ds>."""

        ws = get_workspace(ws_name)

        with webapp.mightNotFound("dataStore", workspace=ws_name):
            info = ws.get_datastore_info(ds_name)
        connectionParameters = info.get("connectionParameters", {})

        return {"dataStore": {
                    "name": info["name"],
                    "enabled": True, # Always enabled
                                     # TODO: Handle enabled/disabled states
                    "workspace": {
                        "name": ws.name,
                        "href": "%s/workspaces/%s.%s" % (
                            web.ctx.home, ws.name, format),
                        },
                    "featureTypes": href("%s/workspaces/%s/datastores/%s/featuretypes.%s" % (
                                        web.ctx.home, ws.name, ds_name, format)
                        ),
                    "connectionParameters": Entries(connectionParameters, tag_name="entry"),
                    }
                }