Skip to content

fix: a shared Google Maps route navigates to its destination - #41

Merged
haraldh merged 2 commits into
masterfrom
fix/google-directions
Oct 21, 2026
Merged

haraldh merged 2 commits into
masterfrom
fix/google-directions

Conversation

@haraldh

@haraldh haraldh commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Found while writing the help page: sharing directions from Google Maps did not send the destination.

Link before after
/maps/dir/München/Zugspitze/@47.78,11.07,9z/data=…!1d10.9863!2d47.4211 viewport center 47.7869, 11.0712 Zugspitze 47.4211, 10.9863
/maps/dir/<start lat,lon>/<dest lat,lon>/ the start the destination
/maps/dir/?api=1&destination=… destination destination
/maps/dir/München/Zugspitze/@… (no positions) viewport center geocoded "Zugspitze"
  • A /maps/dir/ link yields its last stop: ?destination=, a coordinate stop, the stop positions in the data= part (!1d<lon>!2d<lat>, last one), or the destination's name geocoded via Nominatim. The viewport is never used for directions.
  • parse() no longer picks up coordinates inside a link as a plain-text place (that is how the viewport slipped through).

Four new tests in TestSharedLocation; 3 of them fail without the fix. All 77 unit tests pass. Not yet tried with a real "Share directions" from the Google Maps app.

Refs #12

🤖 Generated with Claude Code

Sharing directions from Google Maps sent the center of the route's map
view (or, for coordinate stops, the start) to the watch. A /maps/dir/ link
now yields its last stop: from ?destination=, a coordinate stop, the
stop positions in the data part, or by geocoding the destination's name.
Coordinates inside a link are no longer picked up as a plain-text place.

Refs #12
The app's directions links give the stop positions as !3d<lat>!4d<lon>,
not !1d<lon>!2d<lat>. Without them the destination's name was geocoded,
which fails for business names unknown to OpenStreetMap.

Tested on a phone: a route shared from Google Maps arrives on the watch
with its destination.
@haraldh

haraldh commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

Tested with a real "Share directions" from the Google Maps app on the phone: the resolved link gives the destination as !3d<lat>!4d<lon> (not !1d<lon>!2d<lat>), so the first version fell back to geocoding the business name, which Nominatim did not know. Added that format (with a test using made-up coordinates); now the destination arrives on the watch (imported).

@haraldh
haraldh merged commit 8d45bbb into master Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant