(self, path=None, **kwargs)
Adds a polygon dict to the Map.polygons attribute

        The Google Maps API describes a polyline as a "linear overlay of
        connected line segments on the map" and "form a closed loop and define
        a filled region.". The linear paths are defined by a list of Latitude
        and Longitude coordinate pairs, like so:

            { 'lat': y, 'lng': x }

        with each one being a point of the polyline path.

        It accepts a polygon dict representation as well.

        Args:
            path (list(dict)): The set of points of the path

        .. _Polygon:
            https://developers.google.com/maps/documen
            tation/javascript/reference#Polygon
Adds a polygon dict to the Map.polygons attribute
Adds a polygon dict to the Map . polygons attribute
def add_polygon(self, path=None, **kwargs):
        # type: (Optional[List[Dict]], **Any) -> None
        """Adds a polygon dict to the Map.polygons attribute

        The Google Maps API describes a polyline as a "linear overlay of
        connected line segments on the map" and "form a closed loop and define
        a filled region.". The linear paths are defined by a list of Latitude
        and Longitude coordinate pairs, like so:

            { 'lat': y, 'lng': x }

        with each one being a point of the polyline path.

        It accepts a polygon dict representation as well.

        Args:
            path (list(dict)): The set of points of the path

        .. _Polygon:
            https://developers.google.com/maps/documen
            tation/javascript/reference#Polygon
        """

        if path:
            if not isinstance(path, list):
                raise AttributeError(
                    "The path is a list of dictionary of"
                    "latitude and longitudes por path points"
                )
            for i, point in enumerate(path):
                if not isinstance(point, dict):
                    if isinstance(point, (list, tuple)) and len(point) == 2:
                        path[i] = {"lat": point[0], "lng": point[1]}
                    else:
                        raise AttributeError(
                            "All points in the path must be dicts"
                            " of latitudes and longitudes, list or tuple"
                        )
            kwargs["path"] = path

        kwargs.setdefault("stroke_color", "#FF0000")
        kwargs.setdefault("stroke_opacity", 0.8)
        kwargs.setdefault("stroke_weight", 2)
        kwargs.setdefault("fill_color", "#FF0000")
        kwargs.setdefault("fill_opacity", 0.3)

        self.polygons.append(kwargs)
def add_polygon ( self , path = None , * * kwargs ) : # type: (Optional[List[Dict]], **Any) -> None if path : if not isinstance ( path , list ) : raise AttributeError ( "The path is a list of dictionary of" "latitude and longitudes por path points" ) for i , point in enumerate ( path ) : if not isinstance ( point , dict ) : if isinstance ( point , ( list , tuple ) ) and len ( point ) == 2 : path [ i ] = { "lat" : point [ 0 ] , "lng" : point [ 1 ] } else : raise AttributeError ( "All points in the path must be dicts" " of latitudes and longitudes, list or tuple" ) kwargs [ "path" ] = path kwargs . setdefault ( "stroke_color" , "#FF0000" ) kwargs . setdefault ( "stroke_opacity" , 0.8 ) kwargs . setdefault ( "stroke_weight" , 2 ) kwargs . setdefault ( "fill_color" , "#FF0000" ) kwargs . setdefault ( "fill_opacity" , 0.3 ) self . polygons . append ( kwargs )