Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map orientation: to direction of movement #1040

Closed
deerwood opened this issue Apr 30, 2018 · 36 comments · Fixed by #3335
Closed

Map orientation: to direction of movement #1040

deerwood opened this issue Apr 30, 2018 · 36 comments · Fixed by #3335
Assignees

Comments

@deerwood
Copy link

I tested the compass mode in StreetComplete ... does not work for me at all! Probably because my smartphone case has magnets to close/open it.

As I am using OsmAnd+ all the time for navigation, I know (and love) their "Map orientation: to direction of movement", obviously not influenced by nearby magnets. I believe it works by using GPS positions (with Kalman filter for smoothing).

With that one always sees what's ahead.

Please add this feature, it would help a lot e.g answering the cycleway quests. And it would be nice for users without compass.

@rugk
Copy link
Contributor

rugk commented Apr 30, 2018

That is basically #988, I think.

Just seems you want to make it optional and not the default?

@ENT8R
Copy link
Contributor

ENT8R commented Apr 30, 2018

@deerwood Does it work but the map is always spinning around or does nothing happen if you enable the compass mode?

@deerwood
Copy link
Author

deerwood commented May 1, 2018

@ENT8R it works essentially, display is rather "nervous", but my driving direction is most often not from bottom of screen to top, as wanted and usefull, but arbitrarily left/right, right/left, backwards (top/down) or any other direction. See the short video I made:

http://tugendbol.de/streetcomplete/Alster-20180430-215134.mp4

Note, that the compass symbol top right points to north correctly; probably because it is tied to the map and not showing my phones compass direction.

And yes, I think this feature request is similar #988, exept that I ALWAYS want to have that mode on, even with slow speeds. As said, because of my case using rather strong neodym magnets NO compass app works on my phone.

But OsmAnd+ demonstrates, that the GPS based direction detection works very well, max 20° deviation even when moving slow. They also dampen a lot more

@rugk
Copy link
Contributor

rugk commented May 1, 2018

Exactly the same as I requested I think, now. And AFAIK I did not actually limit it to slow speeds.

I just thought you want it optional as a setting.

@deerwood
Copy link
Author

deerwood commented May 1, 2018

Just let's have 3 map orientations (as in OsmAnd):

  • do not rotate (north always up)
  • to compass
  • to direction of movement (GPS based)

That way the user can choose what works best for him.

@ENT8R
Copy link
Contributor

ENT8R commented May 1, 2018

to direction of movement (GPS based)

So you want this to be calculated? I think this is too complicated and pretty difficult for low speeds like walking...

@deerwood
Copy link
Author

deerwood commented May 2, 2018

@ENT8R yes, I want it to be calculatet. And I don't think it is too complicated, Googling for "calculate direction between two coordinates" gives plenty of results e.g. https://www.movable-type.co.uk/scripts/latlong.html#bearing.

And in OsmAnd it works reliably, see the video I recorded below.

osmand-path

I walked slowly (4 km/h) the green path, starting left bottom in direction NNW, made a sharp turn to WSW, turned 180° and walked back the same path.

Video: http://tugendbol.de/streetcomplete/OsmAnd-GPSDirection-20180501-224848.mp4

Notice how stable the display is. This is, what I want to have in StreetComplete too.

@rugk
Copy link
Contributor

rugk commented May 2, 2018

That looks great. As such, that thing would be a great feature for StreetComplete.
And maybe one would anyway only enable it for higher moving speeds. If you want to suggest that, one could also name the setting "driving mode" or so.

And to get to that neodym magnet thing again: You always carry some with yourself? So that is your actual problem there?😁
Btw as you can see from my other issue, this also happens without them in some cases.
So an option would certainly be fine.

@westnordost
Copy link
Member

Whoever is interested is free to experiment around with adding an option to switch to direction-of-movement mode. I am not sure if it can work out on low speeds and unstable GPS signal (the signal from the video is very stable).

@deerwood
Copy link
Author

deerwood commented May 3, 2018

I'm not an app developer, but a user of SC. Thus it would be hard for me to help implementing this feature (I work with databeses, SQL, PHP, Perl etc). So I ask for help.

@rugk yes, the magnets are always with me; in my phones case;
magnet1
magnet2
And yes, that is the reason, why I can't use the compass mode in the first place. North is most often, where the case magnets tell the phone sensors.

@mahdi1234
Copy link

Would be great to add this to be usable when using bycicle ... I tried today, but app is bit cumbersome to use when on bike as map issues appear too late/unexpectedly and well I'm usually not in mood to turn around, but if I'd see it in advance, I would stop and make the change :)

@rugk
Copy link
Contributor

rugk commented Jun 9, 2018

@westnordost, if you don't want to implement this by yourself better mark it as "help wanted".

@westnordost
Copy link
Member

westnordost commented Jun 9, 2018 via email

@zyphlar
Copy link

zyphlar commented May 25, 2019

This seems to be working somewhat. My compass is always quite off but once I start moving the streetcomplete map seems to orient itself.

Edit: it seems I was just lucky or using a different app, it's actually still compass only and buggy as stated previously.

@lenod
Copy link

lenod commented Dec 5, 2019

Just a remark on this topic: already in osmand the default is to use direction of movement. If I swap to compass mode, it gets about as shaky as in SC. I reckon compass is too sensitive for this usage.

@klawdhfzasjhaa
Copy link

Basically everything that has no high priority for me is.

On June 9, 2018 8:46:40 PM GMT+02:00, rugk @.***> wrote: @westnordost, if you don't want to implement this by yourself better mark it as "help wanted".

In my opinion, this should have a higher priority. People are used to maps following their position / view point. With Street Complete things are different, so users get frustrated and leave. See #988.

Could this perhaps be related to LineageOS?

@riQQ
Copy link
Collaborator

riQQ commented Feb 19, 2021

Another reason: some devices don't even have a compass, but they do have GPS.

Quick search on Geizhals.de:
2253 phones with Android

  • 99.8% have GPS (2248/2253)
  • 79.1% have a compass (1781/2253)

@mnalis
Copy link
Member

mnalis commented Feb 19, 2021

It perhaps might be additional option (if someone is willing to implement), but should not replace compass which is invaluable in finding target: I can rotate toward POI and compass changes immediately, showing target in front of me.

For GPS direction you have to move quite a few meters toward target (and that is assuming good GPS reception, which will likely not be there if you are in densely populated area where you usually need it the most).

@zyphlar
Copy link

zyphlar commented Feb 20, 2021 via email

@BalooUriza
Copy link

BalooUriza commented Feb 24, 2021 via email

@smichel17
Copy link
Member

smichel17 commented Apr 20, 2021

Search term: direction of travel

Related (whoever implements this may want to look at the other issue, too): #2209

@westnordost
Copy link
Member

Alright, I'll implement it.

If it works good, maybe this could even be the default. Let's see.

I looked into the docs and tried some things.
The Android LocationManager actually does return a bearing. It does not return a bearing immediately after getting a GPS fix but only after some walking around, which makes sense. However, the first bearings that are returned are horribly imprecise and when taking a turn, they are also very imprecise at first. It is possible to query the precision of the bearing but only starting with Android 8.0. Since Android versions below that are supported, this can't be used.

So probably I'd end up with storing the user's location each time a new location is returned and calculate a bearing + bearing precsion from that instead. Only right now, I have no idea for a good approach for an algorithm. Any links to how other apps do this would help!

@zyphlar
Copy link

zyphlar commented Sep 27, 2021

OsmAnd has a pretty good version with the caveat that it needs to ignore positions within a small radius like maybe 5-10m... or perhaps within the radius of calculated accuracy. Maybe it could notice that the accelerometer is stationary and not traveling? Because at a stop, OsmAnd will succumb to GPS inaccuracy and orient your direction of travel randomly and only fix itself when you begin moving again. I wonder if the Android API includes fixes for that, if later versions could just use that API

@westnordost
Copy link
Member

Does someone have the link to the source code that handles this of OsmAnd?

@zyphlar
Copy link

zyphlar commented Sep 28, 2021

It's not the best algorithm in the world but https://github.com/osmandapp/OsmAnd/blob/956825357919c8dbc2dac490bd64a8ac8ba6b290/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java#L207

@westnordost
Copy link
Member

Thanks for the link. So, OsmAnd just uses the bearing from the location manager.

@westnordost
Copy link
Member

Screenshot_20211001-130511_StreetComplete Dev

@westnordost
Copy link
Member

It is now automatically shown which way you went for better orientation!

@smichel17

This comment has been minimized.

@westnordost

This comment has been minimized.

@rugk
Copy link
Contributor

rugk commented Oct 1, 2021

It is now automatically shown which way you went for better orientation!

Wait, this is a joke, is not it? Is it already April 1st? You don't really want to make that a production feature?

I may see it could be useful in debug builds, but really in production… drawing random lines where you've been? Is that useful? For whom and why? I cannot imagine it.

Feel free to prove me wrong though, and if you do, I'd propose to have a fade-away UI, so after X m/km or whatever it fades away, i.e. the color gets lighter until you don't see it anymore on the map. So really like a (ski) track…

@mnalis
Copy link
Member

mnalis commented Oct 2, 2021

@rugk see the linked #2209 for explanation (and especially the second picture and related text, which matches your suggestion). The lines are not supposed to be random, but match places where you've been.

@westnordost
Copy link
Member

westnordost commented Oct 2, 2021 via email

@rugk
Copy link
Contributor

rugk commented Oct 2, 2021

Great explanation, yeah, I'm looking forward to testing it! 😊

@zyphlar
Copy link

zyphlar commented Oct 19, 2021

This is really swanky, I had to mash the "GPS" button a few times to get it how I wanted, but the perspective and zoom and line-following makes for a really pleasurable experience!

@mnalis
Copy link
Member

mnalis commented Apr 5, 2022

related: #3377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.