diff --git a/docs/model.map b/docs/model.map deleted file mode 100644 index db9e8c4d7bd9a12504da053e1a32fec5d1269364..0000000000000000000000000000000000000000 --- a/docs/model.map +++ /dev/null @@ -1,83 +0,0 @@ -MAP - - NAME "model" - STATUS ON - IMAGETYPE "png" - RESOLUTION 96 - SIZE 600 600 - EXTENT -180 -90 180 90 - UNITS DD - - OUTPUTFORMAT - NAME "png" - MIMETYPE "image/png" - DRIVER "AGG/PNG" - EXTENSION "png" - IMAGEMODE RGBA - TRANSPARENT TRUE - END - - OUTPUTFORMAT - NAME "png8" - MIMETYPE "image/png; mode=8bit" - DRIVER "AGG/PNG8" - EXTENSION "png" - IMAGEMODE RGB - TRANSPARENT FALSE - FORMATOPTION "QUANTIZE_FORCE=on" - FORMATOPTION "QUANTIZE_COLORS=256" - FORMATOPTION "GAMMA=0.75" - END - - OUTPUTFORMAT - NAME "jpeg" - MIMETYPE "image/jpeg" - DRIVER "AGG/JPEG" - EXTENSION "jpg" - IMAGEMODE RGB - TRANSPARENT FALSE - FORMATOPTION "GAMMA=0.75" - END - - PROJECTION - "init=epsg:4326" - END - - LEGEND - KEYSIZE 20 10 - KEYSPACING 5 5 - LABEL - SIZE MEDIUM - OFFSET 0 0 - SHADOWSIZE 1 1 - TYPE BITMAP - END - STATUS OFF - END - - WEB - - TEMPLATE "foo" - - METADATA - ows_title "model" - ows_abstract "This is a model" - ows_onlineresource "" - ows_service_onlineresource "" - ows_schemas_location "http://schemas.opengeospatial.net" - ows_server_version "1.3.0" - ows_encoding "UTF-8" - ows_srs "EPSG:4326" - - # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # - # `mra' meta contains all the information that MapserverRestAPI # - # needs to work properly. # - # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # - - "mra" "{coveragestores: {}, datastores: {}, layergroups: {}, workspaces: {default: {title: default}}}" - - END - - END - -END \ No newline at end of file diff --git a/src/server.py b/src/server.py index dbaa108e0a02a2a1a89f8ae1660de2023d713468..5e73e8a19fd51bee497cd23664b77fe6e650b001 100755 --- a/src/server.py +++ b/src/server.py @@ -54,14 +54,6 @@ class index(object): def GET(self, format): return "This is MRA." -class tests(object): - def PUT(self, name, format): - spath = tools.safe_path_join(get_config('storage')['mapfiles'], "%s.map" % get_config("testing")["model"]) - tpath = tools.safe_path_join(get_config('storage')['mapfiles'], "%s.map" % name) - open(tpath, "w").write(open(spath).read()) - - webapp.Created("%s/maps/%s%s" % (web.ctx.home, name, format or "")) - class mapfiles(object): @HTTPCompatible() def GET(self, format): @@ -74,18 +66,7 @@ class mapfiles(object): filename = mf.filename.replace(".map", "") mapfiles.append({ "name": filename, - "map_full_path": mf.path, - "href": "%s/maps/%s.%s" % (web.ctx.home, filename, format), - "workspaces": href("%s/maps/%s/workspaces.%s" % (web.ctx.home, filename, format)), - "layers": href("%s/maps/%s/layers.%s" % (web.ctx.home, filename, format)), - "layergroups": href("%s/maps/%s/layergroups.%s" % (web.ctx.home, filename, format)), - "styles": href("%s/maps/%s/styles.%s" % (web.ctx.home, filename, 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"])), + "href": "%s/maps/%s.%s" % (web.ctx.home, filename, format) }) return {"mapfiles": mapfiles} @@ -110,10 +91,20 @@ class named_mapfile(object): mf = get_mapfile(map_name) with open(mf.path, "r") as f: data = f.read() - return {"mapfile": - ({ - "name": map_name, - "content": data}) + 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 @HTTPCompatible() @@ -966,13 +957,6 @@ class layergroup(object): # Index: urlmap(index, "") -# Tests -if get_config("testing")["active"]: - urlmap(tests, "tests", ()) - -# Styler: TODO -#urlmap(styler, format = False) - # Mapfiles: urlmap(mapfiles, "maps") urlmap(named_mapfile, "maps", ()) diff --git a/tests/testScenario.py b/tests/testScenario.py index ae60def3ca169118c989347a9cd1441a501bf63e..7f22ba56848035ffa33e041575472e5a46cac30f 100644 --- a/tests/testScenario.py +++ b/tests/testScenario.py @@ -365,7 +365,6 @@ def test_scenario(): map_name = "tests" # Clean the test file, now we are sure it is empty. - # APIRequest("PUT", target + "/tests/" + map_name) APIRequest("DELETE", target + "/maps/" + map_name) APIRequest("POST", target + "/maps", {"mapfile":{"name":map_name}})