Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw a polygon like google map in android app?

I am creating a map app for a place for my city and i want to draw a polygon around that place.
i have a example of my app idea in web google map like this picture: enter image description here
How can i do like this ?

like image 751
emen Avatar asked Aug 21 '17 18:08

emen


Video Answer


1 Answers

Original documentation has clear explanation for Polygon API. All that you need to do is use this method with own coordinates and colors:

GoogleMap map;
// ... get a map.
// Add a triangle in the Gulf of Guinea
Polygon polygon = map.addPolygon(new PolygonOptions()
    .add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3, 5), new LatLng(0, 0))
    .strokeColor(Color.RED)
    .fillColor(Color.BLUE));
like image 70
Mykhailo Avatar answered Oct 14 '22 09:10

Mykhailo