Add deep link option to route from current location without having to provide coordinates explicitly #3531

Open
opened 2022-10-03 17:43:41 +00:00 by lognaturel · 4 comments
lognaturel commented 2022-10-03 17:43:41 +00:00 (Migrated from github.com)

Thanks to all working on Organic Maps! It's wonderful to see it so vibrant. 🙏

From https://omaps.app/api, I see that I can deep link to get a route using a URL of the following shape:

om://route?sll=50.183933,8.942871&saddr=Start%20Point&dll=49.998912,8.278198&daddr=EndPoint&type=vehicle

I have tried to remove sll and both sll and saddr but it appears both are required. I would like to be able to either omit sll or set it to a well-known value such as current to get directions from the current location.

Background

I work on ODK, an open-source platform for mobile data collection (https://getodk.org). Field workers use the ODK Collect Android app to collect data. Sometimes they need to wayfind and we've documented doing this first with Maps.me and now with Organic Maps. Our users author forms in Excel and can use Android intents or deep links.

In an ODK form, requesting the current location requires end-user intervention in most cases.

We used to document using the BUILD_ROUTE intent:

ex:com.mapswithme.maps.pro.action.BUILD_ROUTE(lat_to=number(${latitude}), lon_to=number(${longitude}), router=${mode})

One of our users just let us know that this no longer works and indeed I see that intent was removed here. It looks like this was first released in 2022.07.27 but not included in the release notes.

Now we can document using the deep link:
concat("om://route?sll=", ${start_lat}, "," ,${start_lon}, "&saddr=Current%20location&dll=", ${latitude}, ",", ${longitude}, "&daddr=Destination&type=", ${mode})

See full form definition here

But it requires having an explicit start location which is not desirable.

Thanks to all working on Organic Maps! It's wonderful to see it so vibrant. 🙏 From https://omaps.app/api, I see that I can deep link to get a route using a URL of the following shape: `om://route?sll=50.183933,8.942871&saddr=Start%20Point&dll=49.998912,8.278198&daddr=EndPoint&type=vehicle ` I have tried to remove `sll` and both `sll` and `saddr` but it appears both are required. I would like to be able to either omit `sll` or set it to a well-known value such as `current` to get directions from the current location. ### Background I work on ODK, an open-source platform for mobile data collection (https://getodk.org). Field workers use the ODK Collect Android app to collect data. Sometimes they need to wayfind and we've documented doing this first with Maps.me and now with Organic Maps. Our users author forms in Excel and can use Android intents or deep links. In an ODK form, requesting the current location requires end-user intervention in most cases. We used to document using the `BUILD_ROUTE` intent: `ex:com.mapswithme.maps.pro.action.BUILD_ROUTE(lat_to=number(${latitude}), lon_to=number(${longitude}), router=${mode})` One of our users just let us know that this no longer works and indeed I see that intent was removed [here](https://git.omaps.dev/organicmaps/organicmaps/commit/25cc893152bc7a52f92302ce63731c75d0ad32d1). It looks like this was first released in 2022.07.27 but not included in the release notes. Now we can document using the deep link: `concat("om://route?sll=", ${start_lat}, "," ,${start_lon}, "&saddr=Current%20location&dll=", ${latitude}, ",", ${longitude}, "&daddr=Destination&type=", ${mode})` See full form definition [here](https://docs.google.com/spreadsheets/d/1g4k3JD0qsoSULMnu4wA4menq8JCNhrtEc3WDk-lM67I/edit#gid=0) But it requires having an explicit start location which is not desirable.
biodranik commented 2022-10-03 21:58:45 +00:00 (Migrated from github.com)

Thank you for the very detailed issue!

It's about Android only, right? Am I correctly understanding that before version 2022.07.27 it worked properly in OM?

@rtsisyk can you please restore the removed API behavior in a new format? I think the best approach would be to use the current position as the starting point if sll param is missing, and as an ending point if dll param is missing (routes to the current position probably won't work yet).

Thank you for the very detailed issue! It's about Android only, right? Am I correctly understanding that before version 2022.07.27 it worked properly in OM? @rtsisyk can you please restore the removed API behavior in a new format? I think the best approach would be to use the current position as the starting point if `sll` param is missing, and as an ending point if `dll` param is missing (routes to the current position probably won't work yet).
Owner

@lognaturel, thanks for relying on our API! We will fix it for you.

We used to document using the BUILD_ROUTE intent

To be honest, old MWM API wasn't properly reviewed, tested and documented until 2022.07.27, so it is a big surprise that SOME cases there were actually working. In 2022.07.27 we reviewed all things and started to document and legalize this API for developers. Old MapsWithMe com.mapswithme.maps.pro.action.* API has been removed in favor of om://*:

  • com.mapswithme.maps.pro.action.BUILD_ROUTE => om://route
  • com.mapswithme.maps.pro.action.SHOW_ON_MAP => om://map

Both methods duplicated each other. The only one major difference was how input parameters were passed (Bundle vs URL). Please check https://github.com/organicmaps/api-android for actual examples.

I have tried to remove sll and both sll and saddr but it appears both are required. I would like to be able to either omit sll or set it to a well-known value such as current to get directions from the current location.

Yes, sll and saddr should be optional. I can see that omitting sll and saddr leads to "Navigation is available only from your current location". This issue should be addressed. I will try to raise a PR as soon as get time to fix it.

@lognaturel, thanks for relying on our API! We will fix it for you. > We used to document using the BUILD_ROUTE intent To be honest, old MWM API wasn't properly reviewed, tested and documented until 2022.07.27, so it is a big surprise that SOME cases there were actually working. In 2022.07.27 we reviewed all things and started to document and legalize this API for developers. Old MapsWithMe `com.mapswithme.maps.pro.action.*` API has been removed in favor of `om://*`: - `com.mapswithme.maps.pro.action.BUILD_ROUTE` => `om://route` - `com.mapswithme.maps.pro.action.SHOW_ON_MAP` => `om://map` Both methods duplicated each other. The only one major difference was how input parameters were passed (Bundle vs URL). Please check https://github.com/organicmaps/api-android for actual examples. > I have tried to remove sll and both sll and saddr but it appears both are required. I would like to be able to either omit sll or set it to a well-known value such as current to get directions from the current location. Yes, `sll` and `saddr` should be optional. I can see that omitting `sll` and `saddr` leads to "Navigation is available only from your current location". This issue should be addressed. I will try to raise a PR as soon as get time to fix it.
lognaturel commented 2022-10-07 16:22:18 +00:00 (Migrated from github.com)

It's about Android only, right? Am I correctly understanding that before version 2022.07.27 it worked properly in OM?

Yes and yes.

old MWM API wasn't properly reviewed, tested and documented until 2022.07.27, so it is a big surprise that SOME cases there were actually working

Hehe, we have some of that style of integration in our codebase too. Thanks for doing the work to modernize yours!

Please check https://github.com/organicmaps/api-android for actual examples.

Thanks for this pointer. We don't want our Android app to integrate with OM, we want forms rendered by our Android app to do the integration. This uses generic dynamic intent builder functionality in ODK Collect. I think our best bet is to use the deep links directly. In fact, I think exposing that option a bit more explicitly is helpful: https://github.com/organicmaps/api-android/pull/4

I will try to raise a PR as soon as get time to fix it.

Thanks so much, we really appreciate it!

> It's about Android only, right? Am I correctly understanding that before version 2022.07.27 it worked properly in OM? Yes and yes. > old MWM API wasn't properly reviewed, tested and documented until 2022.07.27, so it is a big surprise that SOME cases there were actually working Hehe, we have some of that style of integration in our codebase too. Thanks for doing the work to modernize yours! > Please check https://github.com/organicmaps/api-android for actual examples. Thanks for this pointer. We don't want our Android app to integrate with OM, we want *forms rendered by our Android app* to do the integration. This uses generic dynamic intent builder functionality in ODK Collect. I think our best bet is to use the deep links directly. In fact, I think exposing that option a bit more explicitly is helpful: https://github.com/organicmaps/api-android/pull/4 > I will try to raise a PR as soon as get time to fix it. Thanks so much, we really appreciate it!
Owner

Sorry for the late answer. The proposed change is possible, but requires refactoring of legacy C++ code. We haven't started yet.

Sorry for the late answer. The proposed change is possible, but requires refactoring of legacy C++ code. We haven't started yet.
This repo is archived. You cannot comment on issues.
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: organicmaps/organicmaps-tmp#3531
No description provided.