Apps-android-commons: Show map scale

Created on 27 Dec 2018  ·  28Comments  ·  Source: commons-app/apps-android-commons

Like in Google Maps.
Useful when planning another area

assigned good first issue nearby

Most helpful comment

I would say it is fine.
Further enhancements can be filed as separate enhancement GitHub issues :-)

On Fri, Mar 13, 2020 at 4:08 AM 318anushka notifications@github.com wrote:

Passed the default value (same as that of "place type") and this looks
fine now.
Also about visibility , i tried to enable scaleBar visibility only when
bottom sheet is dragged or state changed but looks like the method isn't
called. Any fixes to that or is it fine for now?

[image: Screenshot 2020-03-12 at 10 57 02 PM]
https://user-images.githubusercontent.com/45694892/76557632-efa11b00-64c1-11ea-818c-e5cd72ec919f.png


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/commons-app/apps-android-commons/issues/2238#issuecomment-598366917,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAYKBSTS6AEDNJKECL4JE3RHEXKRANCNFSM4GMJYZ3A
.

All 28 comments

@nicolas-raoul May I work on this?

@pgmpofu Yes it is yours :-)
Let us know about your progress once a day or so.
Thanks!

Since there hasn't been any updates on this issue, can I take it up?

@namrata-jha I have forked a branch and am currently working on it

@pgmpofu Cool looking forward to your pull request :-)

@namrata-jha please take over this issue. I apologize for the inconvenience but I am unable to complete due to other commitments.

@nicolas-raoul , Can i take this one if no one is working on it?

@318anushka Sure. I've assigned this issue to you. Let us know how you get on. Also let us know if you need any help with something. 🙂

Thanks @sivaraam I'll keep you updated with the work.

I am an outreachy applicant and since this is my first issue so i'll be needing a little help with it.
So i am thinking to proceed with scale bar plugin as it is used with mapbox object.

I am an outreachy applicant and since this is my first issue so i'll be needing a little help with it.

Sure. Feel free to ask for help when you need it. 👍

So i am thinking to proceed with scale bar plugin as it is used with mapbox object.

Yeah, proceed with that.

@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {

    mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() {
        @Override
        public void onStyleLoaded(@NonNull Style style) {

            scaleBarPlugin = new ScaleBarPlugin(mapView, mapboxMap);
            scaleBarOptions = new ScaleBarOptions(getContext())
                    .setTextColor(R.color.button_background_light)
                    .setTextSize(35f)
                    .setBarHeight(10f)
                    .setBorderWidth(5f)
                    .setMetricUnit(true)
                    .setRefreshInterval(15)
                    .setMarginTop(50f)
                    .setMarginLeft(15f)
                    .setTextBarMargin(15f);

            scaleBarPlugin.create(scaleBarOptions);
            scaleBarPlugin.setEnabled(true);
        }
    });

}

This is my code for implementing Scalebar in NearbyParentFragment. I have also included necessary dependencies but it won't work.
What am i missing.

@318anushka is this code getting executed? I think I just saw some ticket about onMapReady never firing but it could have been quite old. Put a breakpoint in this method and see if it gets triggered when you debug

@318anushka is this code getting executed? I think I just saw some ticket about onMapReady never firing but it could have been quite old. Put a breakpoint in this method and see if it gets triggered when you debug

yes you're right , i checked and it's not getting executed but according to following article:

https://stackoverflow.com/questions/27531037/onmapready-not-calling-even-though-the-map-display-without-any-error?rq=1

onMapReady() is triggered by getMapAsync() and we are calling that in onViewCreated()

okay, i figured.How does this look?
Let me know if any styling or position changes are required.

Screenshot_20200311-221026__01
Screenshot_20200311-220915__01

@318anushka There was a recent change (#3485) as a consequence of which the logo and trademark are shown in the bottom left corner too. Can you checkout the latest master (which contains the change) and apply your changes over them to see how they both play together?

BTW, the scale looks good. Can you also check that the scale bar doesn't take up a lot of space in a small screen device?

Yeah sure I'll check that.

On Wed, Mar 11, 2020, 10:41 PM Kaartic Sivaraam notifications@github.com
wrote:

BTW, the scale looks good. Can you also check that the scale bar doesn't
take up a lot of space in a small screen device?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/commons-app/apps-android-commons/issues/2238#issuecomment-597756394,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AK4T7LDWPM2PPIVSVSVGHN3RG7A33ANCNFSM4GMJYZ3A
.

BTW, the scale looks good. Can you also check that the scale bar doesn't take up a lot of space in a small screen device?

i have changed orientation and scaling a bit because scalebar is positioned wrt top left corner so it was creating problem in smaller screen device (i tried on Nexus S 4.0 inch) . Also it was overlapping with the compass at bottom corner.Now it works fine
Screenshot_20200312-005149
Screenshot 2020-03-12 at 12 58 40 AM

Looks good, thanks a lot Anushka :-)

@318anushka The scale looks perfect in the first screen shot. But the scale seems to be taking up considerable amount of space in the small screen device. The amount of place to access to access the map is already pretty less in the small screen device. So, even a little space matters there. Is there any way to improve this? For instance, in my device Google maps shows the scale only when I zoom in/out the map. Is it possible to do something like that?

So scaling is fine , I should just work on visibility?

On Thu, Mar 12, 2020, 12:08 PM Kaartic Sivaraam notifications@github.com
wrote:

@318anushka https://github.com/318anushka The scale looks perfect in
the first screen shot. But the scale seems to be taking up considerable
amount of space in the small screen device. The amount of place to access
to access the map is already pretty less in the small screen device. So,
even a little space matters there. Is there any way to improve this? For
instance, in my device Google maps shows the scale only when I zoom in/out
the map. Is it possible to do something like that?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/commons-app/apps-android-commons/issues/2238#issuecomment-598030562,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AK4T7LCRMXXQBDWMMBLAHTLRHB7PJANCNFSM4GMJYZ3A
.

In the first screenshot, the font size of "750 m" is similar to the font size of "Place type".
In the second screenshot, the font size of "250 m" is much larger than the font size of "Place type".

Ideally, the font size should always be more or less similar to the font size of "Place type". Not sure what controls that.
Similarly, the width of the black/white bar is similar to the handle of the loop in the first screenshot, but about double in the second screenshot.

If there is an easy way to fix this, that would be great. If not, I guess it is good enough for now :-)

A fixed float value is passed as parameter for all font size. I'll check if something can be done.

Passed the default value (same as that of "place type") and this looks fine now.
Also about visibility , i tried to enable scaleBar visibility only when bottom sheet is dragged or state changed but looks like the method isn't called. Any fixes to that or is it fine for now?

Screenshot 2020-03-12 at 10 57 02 PM

I would say it is fine.
Further enhancements can be filed as separate enhancement GitHub issues :-)

On Fri, Mar 13, 2020 at 4:08 AM 318anushka notifications@github.com wrote:

Passed the default value (same as that of "place type") and this looks
fine now.
Also about visibility , i tried to enable scaleBar visibility only when
bottom sheet is dragged or state changed but looks like the method isn't
called. Any fixes to that or is it fine for now?

[image: Screenshot 2020-03-12 at 10 57 02 PM]
https://user-images.githubusercontent.com/45694892/76557632-efa11b00-64c1-11ea-818c-e5cd72ec919f.png


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/commons-app/apps-android-commons/issues/2238#issuecomment-598366917,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAYKBSTS6AEDNJKECL4JE3RHEXKRANCNFSM4GMJYZ3A
.

@318anushka This does look a lot better now :)

That looks fine to me @318anushka . Feel free to submit your PR for this. :)

Was this page helpful?
0 / 5 - 0 ratings