Clustering points in Esri-Maps


I am using ArcGIS maps by Esri for Android SDK link to ArcGIS to display some points on the map. So far I have removed points with same coordinates via removeDupes and just drawn the coordinates that are not duplicated. Then between the points are lines that are connecting them.

OnClick I can see the information about 1 point.

Now instead of removing duplicates I need to display the same points in a cluster. Basically a bigger circle that would display how many points are on the same coordinates and then when the cluster is clicked on it would show all of the points that are actually in there.

Here is the code on how to add the points to the map:

private void plotRoute(List<DeliveryPoint> deliveryPoints) {
        Logger.d("Plotting " + deliveryPoints.size() + " coordinates.");
        pointsOfInterest = removeDupes(deliveryPoints);

        SpatialReference SPATIAL_REFERENCE = SpatialReferences.getWgs84();

        // create a red (0xFFFF0000) circle simple marker symbol
        SimpleMarkerSymbol redCircleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 10);
        SimpleMarkerSymbol bigOrange = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF8000, 20);
        SimpleMarkerSymbol bigBlue = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFF0000FF, 20);

        ArrayList<Graphic> poiMarkers = new ArrayList<>();
        ArrayList<Graphic> labels = new ArrayList<>();
        // create a new point collection for polyline
        PointCollection points = new PointCollection(SPATIAL_REFERENCE);

        int ordinal = 0;
        int length = pointsOfInterest.size();
        for (DeliveryPoint poi: deliveryPoints) {
            Point point = new Point(poi.longitude, poi.latitude, SPATIAL_REFERENCE);

            TextSymbol label = new TextSymbol(12, "" + ++ordinal, 0xFFFF0000, TextSymbol.HorizontalAlignment.CENTER, TextSymbol.VerticalAlignment.MIDDLE);
            Graphic labelGraphic= new Graphic(point, label);

            Graphic graphic = new Graphic(point, redCircleSymbol);
            if(ordinal == 1) {
                graphic = new Graphic(point, bigOrange);
            } else if (ordinal == length) {
                graphic = new Graphic(point, bigBlue);
            graphicDeliveryPointCoordinatesHashMap.put(graphic, poi);

        // create a polyline from the point collection
        Polyline polyline = new Polyline(points);

        //define a line symbol
        SimpleLineSymbol lineSymbol =
                new SimpleLineSymbol(
                        Color.argb(255, 255, 128, 0), 1.0f);

        // create the graphic with polyline and symbol
        Graphic lines = new Graphic(polyline, lineSymbol);

        // add graphic to the graphics overlay

        mapView.setOnTouchListener(new PoiTouchListener(this, mapView, poiOverlay));

I have found documentation on how to do that in JavaScript Link to JS clustering but that did not help me as there seems to be no official support for Android Clustering.

Is there a way for a workaround to approach this problem?

asked on Stack Overflow Nov 6, 2019 by kataroty • edited Nov 6, 2019 by Phantômaxx

1 Answer


Even after the 100.x releases, the SDKs don't have the same capabilities. There is no out of the box Cluster Layer within mobile SDKs.

However, there are a few custom implementations that do what you're looking for. This one seems to be matching your use case:

answered on Stack Overflow Nov 6, 2019 by ddc • edited Nov 7, 2019 by ddc

User contributions licensed under CC BY-SA 3.0