def preview(): try: # initialize the catalog so this route will fail if the source doesn't exist make_catalog(request.args) except Exception: return redirect(url_for("index"), code=303) return ( render_template( "preview.html", tilejson_url=Markup( url_for("meta", _external=True, _scheme="", **request.args) ), source_url=request.args["url"], ), 200, {"Content-Type": "text/html"}, )
def preview(): return ( render_template( "preview.html", tilejson_url=Markup( url_for("meta", _external=True, _scheme="", **request.args) ), ), 200, {"Content-Type": "text/html"}, )
def meta(): meta = { "bounds": CATALOG.bounds, "center": CATALOG.center, "maxzoom": CATALOG.maxzoom, "minzoom": CATALOG.minzoom, "name": CATALOG.name, "tilejson": "2.2.0", "tiles": [ "{}{{z}}/{{x}}/{{y}}?{}".format( url_for("meta", _external=True, _scheme=""), urlencode(request.args) ) ], } return jsonify(meta)