def get_target_data(): required_keys = ['X', 'Y', 'h'] js = list(request.json.keys()) js.sort() shell_id = 'm21' if request.json: for key in required_keys: if key not in js: app.logger.error("Not enough data: {0}".format(request.json)) abort(400) else: abort(400) app.logger.debug(request.json) tar_lat, tar_lon = geodesy.XYtoBL.get_BL(X=request.json['X'], Y=request.json['Y']) app.logger.debug((tar_lat, tar_lon)) if 'shell' in request.json: shell_id = request.json['shell'] res = calculation.get_adjustment_settings(tar_lat, tar_lon, shell_id) app.logger.info("Adjustment settings: {0}".format(res)) res["error"] = False response = jsonify(res) return response, 201
import json import calculation import geodesy.XYtoBL X = 5398431 Y = 7394935 tar_lat, tar_lon = geodesy.XYtoBL.get_BL(X, Y) point2 = {"lon": 37.57241, "lat": 48.70979} res = calculation.get_adjustment_settings(tar_lat, tar_lon) print(json.dumps(res, indent=2, sort_keys=True))