Example #1
0
    simpl_buf = request.args.get("simpl_buf")
    simpl_dp = request.args.get("simpl_dp")

    if code != None and wkt != None:
        expression = "ST_SetSRID(ST_Multi(ST_GeomFromText('%s')), 4326)" % wkt

        Region(name=name, code=code, expression=expression, simpl_buf=simpl_buf, simpl_dp=simpl_dp).add()
        DBSession.commit()

        region = Region.filter_by(code=code).one()

        return flask.jsonify({"id": region.id, "result": "created"})

    else:
        return (
            flask.jsonify(
                {
                    "result": "failed",
                    "error": "not_enough_arguments",
                    "errorMsg": "You need to specify code and wkt or geo_json at least",
                }
            ),
            500,
        )


if __name__ == "__main__":
    from osmshp import Env

    app.env = Env()
    app.run(host="0.0.0.0", debug=True)
Example #2
0
        session["snapshots_email"] = bid_data["email"]
    return redirect(url_for("your_snapshots"))


@app.route("/upload", methods=["POST"])
@authenticated
def upload():
    """Upload a photo"""
    return redirect(url_for("snapshot"))


@app.route("/snapshot", methods=["GET"])
@authenticated
def snapshot():
    """Your snapshot"""
    # TODO: Add upload call to snappy
    return render_template("snapshot.html")


@app.route("/logout", methods=["GET"])
def logout():
    """Log the user out"""
    session["snapshots_email"] = None
    return redirect(url_for("main"))


if __name__ == "__main__":
    app.debug = settings.DEBUG
    app.env = "dev"
    port = int(os.environ.get("PORT", 5000))
    app.run(host="0.0.0.0", port=port)