Welcome back.
In this video we're going to learn about polygons.
Polygons are closed shapes defined by a series of connected points that form a boundary.
They are perfect for making areas like parks, property boundaries, or any custom region on a map.
For creating a simple polygon, let's start by defining a new polygon inside the map.
Google map cube.
Scroll down.
Let's start by polygon composable function.
And this composable has many parameters points.
Clickable fill color.
Geodesic holes.
Stroke color, stroke, join type, stroke pattern, stroke width tag, visible z index, and onclick
similar to that of the polyline.
We are interested in points and which is mandatory, and this points parameter is a list of lat long.
So again we need to create a list of lat long similar to what we've created before.
Let's create a list of lat lungs.
And those lat long are for Los Angeles, San Francisco, and San Diego.
Let's create this triangle, this polygon.
Inside the polygon, set the points to triangle points.
Run the application.
This is our polyline.
Let's go to America and here we go.
This is the triangle.
This is the polygon.
Okay.
So you can notice San Francisco Los Angeles and San Diego.
This is the polygon.
We can customize the fill color the stroke color stroke width and other parameters.
So fill color color dot example red stroke color color dot white stroke width to f stroke.
You can customize the stroke pattern, stroke Joan type Holds geodesic and others.
Let me run again.
Here is our polygon.
You can notice.
Points refer for list of lat long.
Defining the shape.
Boundary.
Fill color.
Interior color.
Use transparency for best results.
And this is the internal color red and the stroke color border line.
You can notice that the white color which is the stroke color, stroke width border thickness in pixels
to F and others.
Okay, we can make it as clickable through set on click.
For example let me add log v polygon is clicked.
Run again.
Navigate to San Diego open look at search for taggy.
Click on the polygon and you can notice polygon is clicked.
This is how we create polygons in Google Map, how to customize them, and how to handle the click events
on those polygons.