flyto
This commit is contained in:
parent
cbc87c7c82
commit
59cbf3eb4d
2 changed files with 7 additions and 4 deletions
|
@ -35,6 +35,8 @@ def hello_world():
|
|||
abort(400)
|
||||
cur.execute("SELECT id FROM connections WHERE start = %s AND goal = %s", [request.args["from"], request.args["to"]])
|
||||
result = cur.fetchone()
|
||||
if not result:
|
||||
abort(404)
|
||||
return redirect(url_for("get_connection", connection_id=int(result[0])))
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
maxZoom: 19,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
});
|
||||
var emptyLayer = L.tileLayer("").addTo(map);
|
||||
var emptyLayer = L.tileLayer("", {maxZoom: 19}).addTo(map);
|
||||
|
||||
var citybikeIcon = L.Icon.extend({
|
||||
options: {
|
||||
|
@ -166,7 +166,6 @@
|
|||
success: function (data) {
|
||||
lines.addData(data);
|
||||
lines.addTo(map);
|
||||
console.log(linesArray);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -229,9 +228,11 @@
|
|||
from: fromId,
|
||||
to: toId
|
||||
}).done(function (data) {
|
||||
|
||||
lines.addData(data);
|
||||
|
||||
var id = data.features[0].properties.id;
|
||||
lines.getLayer(linesArray[id]["leafletId"]).openPopup();
|
||||
var bounds = lines.getLayer(linesArray[id]["leafletId"]).getBounds();
|
||||
map.flyToBounds(bounds);
|
||||
});
|
||||
$(".clearButton").on("click", function () {
|
||||
var allLines = lines.getLayers();
|
||||
|
|
Reference in a new issue