def tile(request, project_hash, publish, layers_hash=None, z=None, x=None, y=None, format=None): params = {key.upper(): request.GET[key] for key in request.GET.keys()} project = params['PROJECT'] + '.qgs' mapserver_url = set_query_parameters(settings.GISQUICK_MAPSERVER_URL, {'MAP': abs_project_path(project)}) layer_params = get_project_layers_info(project_hash, publish, project=project) if layer_params: try: layer = WmsLayer(project=project_hash, publish=publish, name=layers_hash, provider_layers=params['LAYERS'].encode("utf-8"), provider_url=mapserver_url, image_format=format, tile_size=256, metasize=5, **layer_params) return get_tile_response(layer, z=z, x=x, y=y) except TileNotFoundException as e: raise Http404 raise Http404
def legend(request, project_hash, publish, layer_hash=None, zoom=None, format=None): params = {key.upper(): request.GET[key] for key in request.GET.keys()} project = params['PROJECT'] + '.qgs' mapserver_url = set_query_parameters(settings.GISQUICK_MAPSERVER_URL, {'MAP': abs_project_path(project)}) project_info = get_project_info(project_hash, publish, project=project) if not project_info: raise Http404 if not check_project_access(request, params['PROJECT'], project_info['authentication']): raise PermissionDenied try: layer = WmsLayer( project=project_hash, publish=publish, name=layer_hash, provider_layers=params['LAYER'].encode('utf-8'), provider_url=mapserver_url, image_format=format, ) params.pop('PROJECT') params.pop('LAYER') return get_legendgraphic_response(layer, zoom, **params) except: raise Http404
def mapcache_legend_request(self, request, project_hash, publish, layer_hash=None, zoom=None, format=None): params = { key.upper(): request.GET[key] for key in request.GET.iterkeys() } project = params['PROJECT'] + '.qgs' try: layer = WmsLayer( project=project_hash, publish=publish, name=layer_hash, provider_layers=params['LAYER'].encode('utf-8'), provider_url=set_query_parameters( settings.GISLAB_WEB_MAPSERVER_URL, {'MAP': project}), image_format=format, ) params.pop('PROJECT') params.pop('LAYER') return get_legendgraphic_response(layer, zoom, **params) except: raise Http404
def tile(request, project_hash, publish, layers_hash=None, z=None, x=None, y=None, format=None): params = {key.upper(): request.GET[key] for key in request.GET.keys()} project = params['PROJECT'] + '.qgs' mapserver_url = set_query_parameters(settings.GISQUICK_MAPSERVER_URL, {'MAP': abs_project_path(project)}) project_info = get_project_info(project_hash, publish, project=project) if not project_info: raise Http404 if not check_project_access(request, params['PROJECT'], project_info['authentication']): raise PermissionDenied try: layer = WmsLayer(project=project_hash, publish=publish, name=layers_hash, provider_layers=params['LAYERS'].encode("utf-8"), provider_url=mapserver_url, image_format=format, tile_size=256, metasize=5, extent=project_info['extent'], resolutions=project_info['tile_resolutions'], projection=project_info['projection']['code']) return get_tile_response(layer, z=z, x=x, y=y) except TileNotFoundException as e: raise Http404