Tracks and routes as containers of points: listed (collapsed) under them in the tree, added via a point's popup, a new note or the route planner's navigation pins, and written as course points into the FIT course
This commit is contained in:
1 parent
6aa7b34f92
commit
4265421457
10 files changed
+354
-20
No files matched your search
@@ -218,7 +218,11 @@ module Maptool
|
||||
when "foot" then vehicle["speed"].to_f >= 7 ? "running" : "hiking"
|
||||
else props["activity_type"]
|
||||
end
|
||||
FitCourse.encode(coordinates, name: props["name"] || name, sport: sport, duration: props["duration_secs"])
|
||||
points = JSON.parse(geojson)["features"].select { |f| f.dig("geometry", "type") == "Point" }.map do |f|
|
||||
p = f["properties"] || {}
|
||||
{ coordinate: f["geometry"]["coordinates"], name: p["name"], hint: [p["name"], p["category"], p["icon"]].compact.join(" ") }
|
||||
end
|
||||
FitCourse.encode(coordinates, name: props["name"] || name, sport: sport, duration: props["duration_secs"], points: points)
|
||||
rescue ArgumentError
|
||||
nil
|
||||
end
|
||||
@@ -689,6 +693,17 @@ module Maptool
|
||||
halt 404
|
||||
end
|
||||
|
||||
# A point into a track/route (body: a GeoJSON Point Feature, as for notes).
|
||||
post "/api/library/node/:key/points" do
|
||||
require_login!
|
||||
id = LIBRARY.add_point(params[:key], parse_feature)
|
||||
json id: id, tree: LIBRARY.tree
|
||||
rescue Library::InvalidValue
|
||||
halt 400, json(error: "a Point feature is required")
|
||||
rescue Library::NotFound
|
||||
halt 404
|
||||
end
|
||||
|
||||
# A migrated layer → ordinary items (Library#split_layer).
|
||||
post "/api/library/node/:key/split" do
|
||||
require_login!
|
||||
|
||||
Reference in new issue
Block a user