(self, polylines)
Process data to construct polylines

        This method is built from the assumption that the polylines parameter
        is a list of:
            list of lists or tuples : a list of path points, each one
            indicating the point coordinates --
            [lat,lng], [lat, lng], (lat, lng), ...

            tuple of lists or tuples : a tuple of path points, each one
                indicating the point coordinates -- (lat,lng), [lat, lng],
                (lat, lng), ...

            dicts: a dictionary with polylines attributes

        So, for instance, we have this general scenario as a input parameter:


            polyline = {
                'stroke_color': '#0AB0DE',
                'stroke_opacity': 1.0,
                'stroke_weight': 3,
                'path': [{'lat': 33.678, 'lng': -116.243},
                        {'lat': 33.679, 'lng': -116.244},
                        {'lat': 33.680, 'lng': -116.250},
                        {'lat': 33.681, 'lng': -116.239},
                        {'lat': 33.678, 'lng': -116.243}]
            }

            path1 = [(33.665, -116.235), (33.666, -116.256),
                    (33.667, -116.250), (33.668, -116.229)]

            path2 = ((33.659, -116.243), (33.660, -116.244),
                    (33.649, -116.250), (33.644, -116.239))

            path3 = ([33.688, -116.243], [33.680, -116.244],
                    [33.682, -116.250], [33.690, -116.239])

            path4 = [[33.690, -116.243], [33.691, -116.244],
                    [33.692, -116.250], [33.693, -116.239]]

            polylines = [polyline, path1, path2, path3, path4]
Process data to construct polylines
Process data to construct polylines
def build_polylines(self, polylines):
        # type: (Optional[List[Union[List, Tuple, Dict]]]) -> None
        """Process data to construct polylines

        This method is built from the assumption that the polylines parameter
        is a list of:
            list of lists or tuples : a list of path points, each one
            indicating the point coordinates --
            [lat,lng], [lat, lng], (lat, lng), ...

            tuple of lists or tuples : a tuple of path points, each one
                indicating the point coordinates -- (lat,lng), [lat, lng],
                (lat, lng), ...

            dicts: a dictionary with polylines attributes

        So, for instance, we have this general scenario as a input parameter:


            polyline = {
                'stroke_color': '#0AB0DE',
                'stroke_opacity': 1.0,
                'stroke_weight': 3,
                'path': [{'lat': 33.678, 'lng': -116.243},
                        {'lat': 33.679, 'lng': -116.244},
                        {'lat': 33.680, 'lng': -116.250},
                        {'lat': 33.681, 'lng': -116.239},
                        {'lat': 33.678, 'lng': -116.243}]
            }

            path1 = [(33.665, -116.235), (33.666, -116.256),
                    (33.667, -116.250), (33.668, -116.229)]

            path2 = ((33.659, -116.243), (33.660, -116.244),
                    (33.649, -116.250), (33.644, -116.239))

            path3 = ([33.688, -116.243], [33.680, -116.244],
                    [33.682, -116.250], [33.690, -116.239])

            path4 = [[33.690, -116.243], [33.691, -116.244],
                    [33.692, -116.250], [33.693, -116.239]]

            polylines = [polyline, path1, path2, path3, path4]

        """
        if not polylines:
            return
        if not isinstance(polylines, (list, tuple)):
            raise AttributeError("A list or tuple of polylines is required")

        for points in polylines:
            if isinstance(points, dict):
                self.add_polyline(**points)
            elif isinstance(points, (tuple, list)):
                path = []
                for coords in points:
                    if len(coords) != 2:
                        raise AttributeError("A point needs two coordinates")
                    path.append({"lat": coords[0], "lng": coords[1]})
                polyline_dict = self.build_polyline_dict(path)
                self.add_polyline(**polyline_dict)
def build_polylines ( self , polylines ) : # type: (Optional[List[Union[List, Tuple, Dict]]]) -> None if not polylines : return if not isinstance ( polylines , ( list , tuple ) ) : raise AttributeError ( "A list or tuple of polylines is required" ) for points in polylines : if isinstance ( points , dict ) : self . add_polyline ( * * points ) elif isinstance ( points , ( tuple , list ) ) : path = [ ] for coords in points : if len ( coords ) != 2 : raise AttributeError ( "A point needs two coordinates" ) path . append ( { "lat" : coords [ 0 ] , "lng" : coords [ 1 ] } ) polyline_dict = self . build_polyline_dict ( path ) self . add_polyline ( * * polyline_dict )