Skip to content
Snippets Groups Projects
Commit 18e288bb authored by Maël Méliani's avatar Maël Méliani
Browse files

Updated GET maps/{mapfile name} response.

parent 0cd298c2
No related branches found
No related tags found
No related merge requests found
......@@ -63,18 +63,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}
......@@ -99,10 +88,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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment