WEBVTT

00:00.120 --> 00:02.560
Hello developers, and welcome back.

00:02.760 --> 00:06.760
In this video I'm gonna introduce marker clustering.

00:06.800 --> 00:16.240
Imagine you have a lot of markers you need to display on your map, but the user will be confused when

00:16.280 --> 00:18.240
seeing the like this map.

00:18.280 --> 00:21.240
Okay, so there is a big problem.

00:21.240 --> 00:30.600
We have markers to display, but the map is not pretty and not clear to navigate to see the countries,

00:30.600 --> 00:34.480
to see the regions, to see areas and so on.

00:34.480 --> 00:36.520
So there is a big problem here.

00:36.680 --> 00:38.360
You need to display markers.

00:38.360 --> 00:40.720
But there are a lot of markers.

00:40.720 --> 00:49.720
And there is a sophisticated map and a complex map that the user will not like and adapt to it.

00:49.720 --> 00:59.080
The solution marker clustering is the solution marker clustering is a technique used to manage large

00:59.080 --> 01:09.960
number of markers on a map by grouping nearby markers together when viewed at high zoom levels, then

01:09.960 --> 01:14.240
expanding them into individual markers as you zoom in.

01:14.240 --> 01:18.240
So this is the principle of marker clustering.

01:18.440 --> 01:29.240
In Google Maps, we can use specific library for marker clustering to make our maps looks pretty and

01:29.280 --> 01:30.560
well organized.

01:30.560 --> 01:41.760
Let's go to github.com Google Maps Android, or simply search for the official Google Maps repository.

01:42.000 --> 01:44.480
Scroll down as we did before.

01:44.760 --> 01:50.280
And here we have two libraries the util and widgets.

01:50.440 --> 01:55.320
We worked with scale bars and we introduced this library.

01:55.360 --> 01:58.360
Now let's copy this library.

01:58.400 --> 02:03.800
Compare maps, compose utils and the version 6.6.0.

02:03.840 --> 02:12.040
This is an optionally if you can include compose util libraries for clustering, streetview, metadata

02:12.040 --> 02:13.520
check and etc..

02:13.840 --> 02:22.720
Okay, so copy this library, go to Android Studio and inside build.gradle file.

02:22.920 --> 02:30.920
Just paste this library and I'll name it as Clustering Library and paste it here.

02:30.960 --> 02:35.040
Correct the implementation and click sync.

02:35.040 --> 02:43.360
Now rendering hundreds or thousands of markers simultaneously can cause significant lag.

02:43.680 --> 02:53.080
Clustering reduces the number of onscreen elements at higher zoom levels and improved user experience.

02:53.360 --> 03:03.770
Here we can prevent the marker overlap and visual clutter makes it easier to understand density patterns

03:03.770 --> 03:05.970
at different zoom levels.

03:06.250 --> 03:13.970
Also, it provides a cleaner interface while still allowing access to all data.

03:14.010 --> 03:23.610
And in terms of data visualization, marker clustering is better clearly shows concentrations of points

03:23.610 --> 03:25.170
in certain areas.

03:25.410 --> 03:32.290
Allows users to quickly identify hotspots or areas of interest.

03:32.330 --> 03:38.410
The progressive disclosure shows summary information first, for example, the cluster counts.

03:38.490 --> 03:42.730
Let's take let's take Florida 164.

03:42.850 --> 03:45.530
So this shows summary information.

03:45.530 --> 03:53.810
First the cluster counts and reveals detailed information individual markers only when needed.

03:53.810 --> 04:02.450
So when the user when the user is zooming in the cluster will uh, will disappear and show the real

04:02.450 --> 04:03.170
markers.

04:03.210 --> 04:07.890
You can set appropriate zoom levels for, uh, when clustering should occur.

04:08.090 --> 04:11.130
You can consider adding smooth transitions.

04:11.170 --> 04:19.570
Transitions when clusters expand or collapse, and design clusters to match your apps apps theme and

04:19.570 --> 04:21.650
provide clear information.

04:21.690 --> 04:25.210
Don't worry, we're going to create custom clustering.

04:25.490 --> 04:30.210
So please pay attention to me and follow me step by step.

04:30.330 --> 04:39.370
Marker clustering is particularly valuable in apps that display multiple business locations, user generated

04:39.370 --> 04:48.530
content points, real estate listing, or any other scenario with dense geographical data points.

04:48.650 --> 04:50.290
Back to Android Studio.

04:50.530 --> 04:56.890
Our project has the clustering library, so we're ready to start building our application.
