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

How can I add marker dynamically? #40

Closed
swanhtet1992 opened this issue Jan 13, 2014 · 5 comments
Closed

How can I add marker dynamically? #40

swanhtet1992 opened this issue Jan 13, 2014 · 5 comments

Comments

@swanhtet1992
Copy link

Are there ways to add markers dynamically depending on the area of the map which is shown?
I found that Android Map Extensions [https://code.google.com/p/android-maps-extensions/] has this functionality.
Can we be also achieve like that with this library?

I don't want to switch library since this library is very convenient. 😸

Thanks,
SH

@broady
Copy link
Contributor

broady commented Jan 13, 2014

I'm not sure what you mean - can you just add an OnCameraChangeListener?

The PointQuadTree class might help to do bounding box queries if you have a lot of markers.

@mg6maciej‎ do you know what SH is referring to? Is that something we should/could incorporate into this utils library?

@broady
Copy link
Contributor

broady commented Jan 13, 2014

Oh, I think I know what you mean. Yes, I'm working on it - performance is terrible when zoomed very far in, because all markers are still added to the map (eventually).

I think this is the same as issue #29. Going to close this as a dupe. Thank you!

@broady broady closed this as completed Jan 13, 2014
@swanhtet1992
Copy link
Author

👍 Thank you. 😄

@mg6maciej
Copy link
Contributor

Yes. There is ClusteringSettings.addMarkersDynamically(boolean) in AME, which is a must when working with a lot of markers. A compromise between UX and performance: adding only onscreen markers.

That was one of the very first requests when I started working on AME. Promoting AMU next to the official maps library brought you a lot of attention ;)

@vhdrjb
Copy link

vhdrjb commented Aug 15, 2016

googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
            @Override
            public void onMapClick(LatLng latLng) {
                MarkerOptions marker = new MarkerOptions().position(
                        latLng)
                        .title("Hello Maps ");
                marker.icon(BitmapDescriptorFactory
                        .defaultMarker(BitmapDescriptorFactory.HUE_AZURE));
                googleMap.addMarker(marker);
            }
        });

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

No branches or pull requests

4 participants