larsen / rando-planner

Clerk viewers and utils to plan bikepacking trips
https://rando-planner.stefanorodighiero.net/
4 stars 0 forks source link

Automatically center the map usign the GPX data #8

Closed larsen closed 6 months ago

larsen commented 6 months ago

leaflet/leaflet-gpx-viewer currently requires to specify a point to center the map.

(clerk/with-viewer leaflet/leaflet-gpx-viewer
  {:gpx "https://stefanorodighiero.net/misc/VG-2024_400k_lake_provvis.gpx"
   ;; :gpx-content gpx-content
   :center [45.478431 11.439041]
   :markers (plan/points-at-daily-kilometers
             gpx-resource
             plan-start-19)
   :zoom 9})

It should not be a task of the user

larsen commented 6 months ago

Reference: https://math.stackexchange.com/questions/256694/how-to-calculate-center-point-in-geographic-coordinates

larsen commented 6 months ago

https://github.com/larsen/rando-planner/commit/8591ee56ffb94694b2e9cc7fa6e2a30d9f2e9c94