Open annasoloviova opened 6 years ago
I've observed the iOS app showing 3 digits after the plus while the Android app only shows 2. If you use the search bar the Android app is able to set the marker on the map in the correct location but still only shows the less precise version in the details view.
What I'm trying to say is, there's an inconsistency in OsmAnd between iOS and Android (which isn't a big deal to me). Another more severe inconsistency is in the Android app, which is able to correctly set the pin in the map when searching for a OLC with more than 2 digits behind the plus but when you try to copy the OLC of that exact pin, it will only provide a less precise OLC that only has 2 digits behind the plus and will point to a different spot on the map.
This can be across the road two houses down, for example. So two users of OsmAnd Android will see the same OLC in their app but the pin is in different places on the map. This inconsistency should be fixed imho.
If I understood the code correctly, this should be an easy fix. (Correct me if I'm wrong)
The OLCs seem to be encoded by a function that accepts an optional length parameter (see here). So if that length parameter would be added here it should "just work".
Disclaimer: I haven't tested this and I haven't written any code for OsmAnd in the past, so I'm unfamiliar with the code base. I basically used the GitHub search bar to look for "olc" in the OsmAnd repo.
Indeed we could have up to 15 length, now is 10.
The question is, how much precision do we need? The official Plus Code FAQ says:
Two characters after the “+” sign define an area of less than 14x14 square meters (for example, 8QQ7+V8, Dublin), while three characters after the “+” sign define an area of less than 3x3 square meters (for example, 8QQ7+V8M, Dublin).
I'd say those 3x3 meters might be good enough for most people, especially since GPS on phones isn't much more precise than that anyways in my personal experience. So an OLC of 11 chars should suffice, since a 12 char one would point to a square that's smaller than 1 meter. I don't think anyone would need or even expect that level of precision in OsmAnd.
Also, a 11 char long OLC matches what the iOS app displays so we could unify the user experience across platforms a little bit by using 11 chars in the android app.
edit wrong number of chars
Trying to test this in the source code. Tests are failing left, right and center because my locale has a decimal comma, not a decimal dot, and tests are expecting dots in generated strings but get commas. How do I tell Android Studio to run tests in a different locale?
Edit: Tests are passing now but I don't have enough RAM to compile the app. Should I file a PR even if I cannot test it?
User request: "Add 11 or 12 digits instead of 10 digits. A 14 x 13 meters rectangle may result too big in some cases. By example, I want to mark my grandfather tomb on the cemetery , 10 digits is too low precision for it".