WEBVTT

00:00.120 --> 00:01.040
Welcome back.

00:01.080 --> 00:03.920
In this video we're going to learn about ground overlay.

00:04.160 --> 00:12.080
A ground overlay is an image that's fixed to a map at a specific geographic coordinates.

00:12.120 --> 00:19.160
Unlike markers that appear at points, ground overlays cover an area of the map.

00:19.400 --> 00:26.800
They are useful for displaying historical maps showing planned construction sites, adding custom image

00:26.800 --> 00:32.200
layers, and visualizing heatmaps or special zones.

00:32.200 --> 00:42.040
We can use the map overlays positioned using latitude and longitude coordinates can be rotated and tilted.

00:42.040 --> 00:49.120
Supports transparency and sized using either dimensions with height or bounds.

00:49.160 --> 00:54.000
South west West or north east corners.

00:54.040 --> 00:59.880
Okay, to create a map overlay, we need an image for the position.

00:59.880 --> 01:05.370
So I downloaded this image for New York City and Manhattan.

01:05.370 --> 01:14.450
And I'm gonna use this image, which is historical, for displaying it as an overlay for my map.

01:14.690 --> 01:15.170
Okay.

01:15.370 --> 01:19.650
So copy it, name it as NYC, New York City.

01:19.930 --> 01:25.330
Copy it, place it inside the drawable folder, click okay.

01:25.490 --> 01:26.330
And here we go.

01:26.370 --> 01:34.450
This is our image I need to place it exactly over New York City which is here.

01:34.570 --> 01:35.090
Okay.

01:35.130 --> 01:39.090
Let's start with the Manhattan coordinates.

01:39.090 --> 01:41.410
I need to create a bound not a marker.

01:41.410 --> 01:47.650
Marker is used for points while while overlays start as a map area.

01:47.770 --> 01:48.290
Okay.

01:48.330 --> 01:53.290
So you use bounds for making a bound for the area using.

01:53.490 --> 01:58.690
When using the map overlay and when using markers, you should specify a point.

01:58.730 --> 02:01.490
Okay, let me start with val.

02:01.530 --> 02:06.740
Manhattan bounds equals to lat long bounds.

02:06.780 --> 02:07.420
Lat.

02:07.460 --> 02:08.100
Long.

02:08.260 --> 02:11.980
This is the lat long for the south west corner.

02:11.980 --> 02:16.900
And this is the lat long for the north east corner.

02:16.940 --> 02:28.820
Then inside the Google map scope I need to create a ground overlay, which is a composable ground overlay

02:29.020 --> 02:31.580
and the specify the position.

02:31.580 --> 02:35.060
Use this, use this and import this.

02:35.060 --> 02:37.220
Composable, not the class.

02:37.460 --> 02:39.100
Please pay attention.

02:39.100 --> 02:40.220
This is a composable.

02:40.220 --> 02:41.060
This is a class.

02:41.060 --> 02:50.060
And you can notice that we we have a position image anchor bearing clickable and those parameters for

02:50.060 --> 02:51.180
the ground overlay.

02:51.500 --> 02:52.820
And I'll use it.

02:52.820 --> 02:56.820
So please pay attention to the things that you import.

02:56.860 --> 02:59.780
Set the position to Manhattan bounds.

02:59.820 --> 03:04.100
The image would be from Bitmap Descriptor Factory.

03:04.140 --> 03:11.790
Don't worry I'm going to explain everything from from a resource are that drawable dot Manhattan or

03:11.830 --> 03:12.430
NYC.

03:12.630 --> 03:20.310
Then set the transparency to 0.3 f, which is 30% transparency.

03:20.710 --> 03:26.710
Okay, let me open the ground overlay composable by Ctrl and left click.

03:26.830 --> 03:28.670
And this is the Google map.

03:28.670 --> 03:29.670
Composable.

03:29.910 --> 03:31.790
We have many parameters.

03:32.150 --> 03:33.950
Let's start with the position.

03:33.990 --> 03:34.830
The position.

03:34.830 --> 03:38.350
This defines the position and size of the overlay.

03:38.510 --> 03:45.070
There are two ways to specify using the latlong bounds or using a Latlong, which is the anchor point

03:45.070 --> 03:52.790
along with the width and height in meters, and Latlong bounds south west and north east corners to

03:52.830 --> 04:00.510
define the area using the ground overlay position, so Ctrl and left click, you can uh, open the ground

04:00.510 --> 04:07.150
overlay position, having the latlong bounds, the location width and height, and this is used for

04:07.150 --> 04:15.080
creating the position of the ground overlay the image, which is a bitmap descriptor that specifies

04:15.080 --> 04:18.200
the image to be used for the overlay.

04:18.240 --> 04:22.520
You can create it using Bitmap Descriptor Factory.

04:22.640 --> 04:31.760
The anchor parameter used along with a width and height in meters to make the offset and make it like

04:31.800 --> 04:35.720
offsetting from the main and the central point.

04:35.760 --> 04:43.360
The bearing the burning, which is an optional parameter, which is the rotation of the overlay in degrees

04:43.360 --> 04:47.760
clockwise from north and the default is zero.

04:47.800 --> 04:48.600
Clickable.

04:48.800 --> 04:52.760
We can specify it, which is an optional parameter.

04:52.760 --> 04:58.760
Also boolean indicating if the overlay is clickable and the default is false.

04:58.800 --> 04:59.960
Transparency.

05:00.280 --> 05:06.160
A float between zero opaque and one transparent for the transparency level.

05:06.200 --> 05:07.400
The default is zero.

05:07.440 --> 05:08.800
We specified it as.

05:09.080 --> 05:17.090
We specify it as 0.3, which is 30% Transparent visible boolean to control the visibility.

05:17.090 --> 05:18.410
Default is true.

05:18.610 --> 05:24.530
Z index the z index of the overlay which determines the stacking order.

05:24.690 --> 05:28.010
Higher values are above lower ones.

05:28.210 --> 05:31.450
Unclick a callback when the overlay is clicked.

05:31.610 --> 05:34.130
Only called if clickable is true.

05:34.490 --> 05:39.170
This is the main parameters of the ground overlay.

05:39.210 --> 05:41.850
Here we have an error required.

05:41.850 --> 05:45.250
Ground overlay position found lat long bounds.

05:45.490 --> 05:50.570
Let me explain about the ground overlay position here.

05:51.050 --> 05:57.690
I'm gonna show you how to convert the ground overlay position to ground overlay.

05:57.810 --> 05:58.290
Okay.

05:58.530 --> 06:01.170
So I want from you to focus with me.

06:01.370 --> 06:08.370
And please pay attention because I am going to show you how to deal with different upgrades and how

06:08.370 --> 06:16.610
to face upgrades of Google Composables and documentations and SDK because Android is keep updating.
