Code Monkey home page Code Monkey logo

google-maps-clustering's People

Contributors

makovkastar avatar meierjan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-maps-clustering's Issues

How can I migrate your library from gms to androdi libraries maps?

Hello.
In my app when I click a cluster it opens dialog fragment with list of items. Then when I click item it opens another fragment. And when I pop back to map fragment my map very lagging. Then if I open dialog again and dismiss it map works as usual.
Found same problem here but there is no any solutions that help me.
It seems that the problem with gms maps, so I tried to modify your library in my app using 'com.google.android.libraries.maps:maps:3.1.0-beta' instead gms and it solved problem with dialog but there is another problem that some markers don't remove when clustering.
Can you help me migrate your library using android libraries maps instead gms?

Clustering issue

I am facing issue with clustering, please see the picture of map its a max zoom of map but still cluster not opened yet?

screenshot_20180118-144031 1

OutOfMemoryError createBitmap

Hi Alex Melnykov,
Firstly I really thank you for your library. I solved my problems about rendering more than 100k markers. But now I'm facing out of memory error about bitmap when I leave and came back to map fragment. I think bitmap resources may not be cleared when fragment was destroyed at first time. Because the first time the map and its clustering is working fine. Do you have any suggestion to solve this problem? I'm new for map implementing, feel free to advise me.
Thanks,
Gaw

Animate cluster when visible

Great library, right now I was looking for a solution whith clustering...

I see in the demo/gir that the cluster is hidden and shown only when necessary

Is posible add animate fade-in when cluster is needed draw in viewport?
Similar objects in google maps, labels, icons...

Or other feature, posible set factor viewport "visible"
increase the viewport as if it were 1.2f, so the clusters are pre-loaded before being visualized

no text in cluster after change icon

i change the cluster icon to a personlized one, but the text dissepire i can't show it
please help and thank you
clusterManager.setIconGenerator(new IconGenerator() {

        @NonNull
        @Override
        public BitmapDescriptor getClusterIcon(@NonNull Cluster<BikesClusterItem> cluster) {
            return vectorCircle;
        }
        @NonNull
        @Override
        public BitmapDescriptor getClusterItemIcon(@NonNull BikesClusterItem clusterItem) {

            BitmapDescriptor pinMarker = finalPinWork;

            switch (clusterItem.getBike_breakdown()){
                case "false":
                    pinMarker = finalPinWork;
                    break;
                case "true":
                    pinMarker = finalPinMaintenance;
                    break;
                default:
                    break;
            }

            return pinMarker;
        }
    });

Cluster range / min cluster size

Hey, thank you for writing this library - google maps utils really lacks maintainers...

I wonder if it's possible to change the range of the clusters. I've just seen the screenshots and the clusters seem very far apart.

Thanks in advance.

Markers not removing after being drawn on map

Hello,
I have an issue where i have 3 types of markers store in 3 list and i display them one at a time by calling clusterManager.setItems(list)
It works very well but some of the markers once they have been drawn on the map (i.e not in a cluster anymore) are not removed when i change the cluster array.
Here is a video showing some markers (blue) being removed when in a cluster but not anymore when they have been drawn on the map.

Video showing the bug

And here the code how i switch between the lists :

clusterManager.setItems(new ArrayList<>());
clusterManager.onCameraIdle();
clusterManager.setItems(newList);

If i remove the call to onCameraIdle more markers stay on the map.
I have more than 10 000 markers.

Since your library hasn't been updated since 2 years i have search for alternative but haven't found any as good as yours for clustering thousands of markers.

synchronization of mQuadTree

Do I understand your code correctly the synchronization of mQuadTree is based on the fact that mExecutor is single-threaded?

Opening issues is the only option I can think of to ask questions so I hope u don't bother.

how to use googleMap.setOnCameraIdleListener after assignment to clusterManager

Hi I have came up with the issue that looks like there is no easy solution around it.

I need to use the following override method to send some request to backed:

        mMap.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener() {
            @Override
            public void onCameraIdle() {

                LatLngBounds curScreen = googleMap.getProjection()
                                                                               .getVisibleRegion().latLngBounds;
                 / /request to backend to give me the points in the curScreen boundary
           
    }
});

however the above will interfere with the functionality of the following line:

mMap.setOnCameraIdleListener(clusterManager);

so the clusters wont split when zooming in.

is there a way that I can use both of the above?

The issue that I am trying to do is very practical. Basically when the camera is IDLE I need to request the points which are in the screen boundary and then assign each point as a cluster item.

so this practice looks like is not doable. Could you please advice?

custom cluster marker

Good morning. Thank you for creating a useful library first. I'm currently using custom cluster markers. When the map is zoomed in or out, the cluster markers change to existing markers. How can I deal with it so that it doesn't change?

Because it is a Google translation, it may not be translated correctly @makovkastar

Issue in clusters calculation depending on the location

Hi !

I'm from Argentina and saw that with negatives values for latitude and longitude the method getClusters return 0.

I fixed it replacing in ClusterManager.java Line: 176 the next sentence:

         `   List<T> points = mQuadTree.queryRange(north > south ? north : south, west < east ? west : east, south < north ? south : north, east > west ? east : west);`

I not have much time now to test whether is the ideal and global solution for the whole map, but it can be a good starting point.

Regards!

Zoom after cluster click

Hi.
I do not understand how to make clustering after click on Cluster?
In google library we go that:

@Override public boolean onClusterClick(final Cluster<MyItem> cluster) { map.animateCamera(CameraUpdateFactory.newLatLngZoom( cluster.getPosition(), (float) Math.floor(map .getCameraPosition().zoom + 1)), 300, null); return true;

In this library we do not have getPosition() so how we can do it?
Sorry, if this is very stupid question I am a beginner in android.

Add possibility to change icon of selected marker

Hi! Thank you for your work!

In app I work on I need to change icon of marker after clicked on it (make it bigger) . Now it's logic sealed in ClusterRenderer class, and there is no any posobility to change that. Easiest way to do it is add Marker from onMarkerClick method to methods of ClusterManager.Callbacks

StackOverFlowException QuadTreeNode.insert

I founded this issue on Android version 4. I think its cause is I had to render all 100k pin on the map at the same time. But I want to know how can I catch exception to handle something to void app crashing?

Crashes when minify/proguard/r8 is enabled

By using the ObjectAnimator when animating map markers, the variable name position gets obfuscated for release, crashing the app.

    private void animateMarkerToLocation(@NonNull final Marker marker, @NonNull LatLng targetLocation,
                                         final boolean removeAfter) {
        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(marker, "position",
                new LatLngTypeEvaluator(), targetLocation);
        objectAnimator.setInterpolator(new FastOutSlowInInterpolator());

I don't know if just adding to the README is enough, or maybe preventing this by embedding proguard rules in the project.

-keep class com.google.android.gms.maps.model.Marker { *; }

Clearing clusters and items in OnResume

Hey it's me again.

I noticed that when I pause my application and come back in all of the items and clusters are still shown. I noticed that there isn't a clustermanager.clear() or similar. what would you recommend on how to deal with that? Thanks.

Cluster Groups

It doesn't appear there is a way to define an algorithm or define cluster group ids. This would allow for objects that implement ClusterItem to define a "type" so only items of a certain group will be clustered. Is this behaviour currently possible?

[Question] Set custom marker icon?

Hi, first of all, thank you for you contribution. I tried the original library by Google and, yes, it's slow. So I found yours! But I'm having some trouble making things work.
I have a custom marker, made like this:

@Override
public void onMapReady(GoogleMap map) {
      final IconGenerator iconFactory = new IconGenerator(this);
           iconFactory.setStyle(IconGenerator.STYLE_BLUE);
    
    addIcon(iconFactory, "9872", locationExample); 
}
private void addIcon(IconGenerator iconFactory, CharSequence text, LatLng position) {
        MarkerOptions markerOptions = new MarkerOptions().
                icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(text))).
                position(position).
                anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV());

        map.addMarker(markerOptions);

And now I'm trying to add your cluster library to it, but I dont know if I can use my already customized markers. If not, does your library have a custom marker icon option? I've tried to do it, but I can't get it work. Could you please give me an example of a custom marker? I just need a marker with a number inside.

This was my best try:

final ClusterManager<SampleClusterItem> clusterManager = new ClusterManager<>(this, map);
        clusterManager.setCallbacks(new ClusterManager.Callbacks<SampleClusterItem>() {
            @Override
            public boolean onClusterClick(@NonNull Cluster<SampleClusterItem> cluster) {
                Log.d(TAG, "onClusterClick");
                return false;
            }

            @Override
            public boolean onClusterItemClick(@NonNull SampleClusterItem clusterItem) {
                Log.d(TAG, "onClusterItemClick");
                return false;
            }
        });
        map.setOnCameraIdleListener(clusterManager);

        IconStyle.Builder stilo = new IconStyle.Builder(this);
        stilo.setClusterBackgroundColor(Color.BLUE);
        stilo.setClusterTextColor(Color.WHITE);

        DefaultIconGenerator icono = new DefaultIconGenerator(this);
        icono.setIconStyle(stilo.build());

Thank you so much :)

No access to InfoWindow for Clusters and ClusterItems

I can't see a way to populate the infoWindow for a Cluster or a ClusterItem with the getTitle() and getSnippet() methods.

I'm overriding the onClick methods but are the infoWindows not accessible here? I may be missing something glaringly obvious, and if so I apologise.

Also, thanks for this library. Performance is amazing and I'm loading up to 450k markers, 200 at a time. :-)

Modifying Library in Existing App

@makovkastar I need to modify some of the library classes such as QuadTree so I can pass additional variables to ClusterItem, but it says that the library is read only since I imported it with gradle.

So I followed guides trying to import it as a module, but always got build errors such as
Error:(11, 0) Could not find method compile() for arguments [project ':subProject:library'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. <a href="openFile:C:\Users\Nathan\Android Projects\ImportModule4\build.gradle">Open File</a>

and

Error:(18, 0) Could not find method android() for arguments [build_enfbvdz6abztfoiqie2qzfmjg$_run_closure1@58eced6f] on root project 'ModuleImport2' of type org.gradle.api.Project. <a href="openFile:C:\Users\Nathan\Android Projects\ModuleImport2\build.gradle">Open File</a>

I followed these guides:
https://stackoverflow.com/questions/41764338/importing-module-in-android-studio
and
https://github.com/MagicMicky/FreemiumLibrary/wiki/Import-the-library-in-Android-Studio

Do you have a recommended method to adding your library to an existing project and be able to modify files?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.