-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Show scale on map #6379
Show scale on map #6379
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually thinking we shouldn't bother with the scale bar for Google Maps given it means pulling in another dependency - especially one that's not been updated for 4 years. Let's just do the OSM/Mapbox changes for now, and we can discuss whether adding scale to Google Maps is worth the risk of us maintaining it in the future in our next sync.
According to our discussion with @lognaturel and @seadowg I've pulled out https://github.com/pengrad/MapScaleView into the |
Tested with Success Verified on device with Android 14 Verified cases:
|
Tested with Success Verified on device with Android 10 |
Closes #6233
Why is this the best possible solution? Were any other approaches considered?
Both Mapbox and OSM have built-in scale bars, but Google Maps doesn’t. It’s strange because, as far as I know, this feature was available in earlier versions but was either removed or never added to newer ones. A scale bar is a basic UI element that should be included in any map engine, like a compass or zoom buttons. The Google Maps app does show a scale bar, so it seems the developers see its value, which makes it even more confusing why it’s missing from the Maps SDK. Interestingly, a scale bar has been added to the Compose version of Google Maps, as seen here: https://googlemaps.github.io/android-maps-compose/maps-compose-widgets/com.google.maps.android.compose.widgets/-scale-bar.html.
The issue with Google Maps is reported here: https://issuetracker.google.com/u/1/issues/35824009, and I’ve added my comment so they know there's more interest in this feature.
To fix the missing scale bar in Google Maps, I used this project: https://github.com/pengrad/MapScaleView. It seems to work well, is used by other developers, and looks similar to what the Google Maps app offers.
I thought about using this solution for all map engines, but I don’t think that’s the best idea because:
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
For Mapbox and OSM, it's sufficient to ensure the scale bar is displayed. However, as mentioned earlier, the Google Maps SDK doesn't offer a built-in scale bar, so I used a third-party library for this purpose. Please verify that it functions correctly and that the values displayed are accurate. Additionally, Google Maps required some minor adjustments to accommodate the scale bar, so please conduct a brief regression test on that map engine.
Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest
(or./gradlew testLab
) and confirmed all checks still passDateFormatsTest