def layer_export(map_name): defn_obj = MapDefinition.get_by_name(map_name) if defn_obj is None: abort(404) from dataexport import export_csv_iter return Response(headers={ 'Cache-Control' : 'max-age=86400, public', 'Content-Disposition' : 'inline; filename="%s.csv"' % urllib.quote(map_name) }, response=export_csv_iter(defn_obj), status=200, content_type='text/csv')
def layer_export(map_name): defn_obj = MapDefinition.get_by_name(map_name) if defn_obj is None: abort(404) from dataexport import export_csv_iter return Response( headers={ 'Cache-Control': 'max-age=86400, public', 'Content-Disposition': 'inline; filename="%s.csv"' % urllib.quote(map_name) }, response=export_csv_iter(defn_obj), status=200, content_type='text/csv')
def layer_export_bounds(map_name, ne, sw): defn_obj = MapDefinition.get_by_name(map_name) if defn_obj is None: abort(404) ne = map(float, ne.split(',')) sw = map(float, sw.split(',')) if len(ne) != 2 or len(sw) != 2: abort(404) from dataexport import export_csv_iter return Response(headers={ 'Cache-Control': 'max-age=86400, public', 'Content-Disposition': 'inline; filename="%s_%f_%f_%f_%f.csv"' % (urllib.quote(map_name), ne[0], ne[1], sw[0], sw[1]) }, response=export_csv_iter(defn_obj, (ne, sw)), status=200, content_type='text/csv')