Package: kmlb
KMLBA Straightforward Google Earth KML BuilderCreate KML files that contain:PlacemarksLines & PolylinesPolygons (2D + 3D)FoldersCustomize:ColorsLabelsIconsCoordinatesElevationsCamera AnglesExample UseWriting a Basic KML file with KMLB:importkmlb# CREATE A POINTfountain=kmlb.point([-71.051904,42.358988,0],'Rings Fountain')# WRITE KML FILEkmlb.kml('Boston Fountain',# KML name[fountain],# Featuresr'C:\Users\UserName\Desktop\KMLB_Tutorial.kml'# Export path)Mapping a POI or an address with KMLB:importkmlb# CREATE A POINT FROM A POIbos_common=kmlb.search_poi('Boston Common, Boston, MA')# CREATE A POINT FROM AN ADDRESSss=kmlb.search_poi('700 Atlantic Avenue, Boston, MA',name='South Station')# WRITE KML FILEkmlb.kml('Boston Landmarks',# KML name[bos_common,ss],# Featuresr'C:\Users\UserName\Desktop\KMLB_Tutorial.kml'# Export path)Creating a Customized KML file with KMLB:importkmlb# DEFINE A STYLEpt_style=kmlb.point_style('Red Triangle',# Point style name'http://maps.google.com/mapfiles/kml/shapes/triangle.png',# Icon('#ff0000',100),# Icon color1.0,# Icon scale('#ffffff',100),# Label color1.0# Label size)# CREATE A POINTcoords=[-71.053568,42.359053,151]name='Custom House Tower'attribute_titles=['City','Building','Height (M)']attributes=['Boston','Custom House Tower','151']altitude_mode='RTG'# 'Relative To Ground'style_to_use='Red Triangle'# Name of point style defined earlierclock_tower=kmlb.point(coords,name,attribute_titles,attributes,altitude_mode,style_to_use)# WRITE KML FILEkmlb.kml('Boston Clock Tower',# KML Name[clock_tower],# Features to includer'C:\Users\UserName\Desktop\KMLB_Tutorial.kml',# Export path'Created with KMLB Python Package',# KML Description[pt_style]# Styles to include)FUNCTIONSGeometry FunctionsPointDefines a KML point element.point()point(coords,name,headers=None,attributes=None,altitude_mode="CTG",style_to_use=None,hidden=False,camera=None)Parameters:Required ParametersParameterTypeDescriptioncoordsListA coordinate set:[X, Y, Z]nameStringThe name to be given to the point feature. The name will be used for labeling.Optional ParametersParameterTypeDescriptionheadersListA list of the attribute titles for the point featureattributesListA list of properties for the point feature.altitude_modeStringOne of the abbreviated altitude mode options:CTG,RTG,ABS(Default ='CTG')style_to_useStringThe name of thepoint_style()to be used (Default =None).hiddenBoolA value ofTrueorFalsewhereFalsemeans that the point will be visible. (Default =False).cameraElementA KML 'LookAt' element. (Default =None)ReturnReturnTypeDescriptionplacemarkObjectAn XML element representing a KML Placemark.About a PointThe first thing that is needed to define apoint()is acoordinate setthat marks the location of where the point is to be mapped. A coordinate set contains three values: X, Y, ZX = Longitude in decimal degreesY = Latitude in decimal degreesZ = Height in metersThe point will also need aname. The point's name will be the value used to label the point on the map.When the point is clicked on in the map, additional information can be displayed. This additional information is defined withheaders(optional) andattributes(optional) parameters. Headers & Attributes work together and can be thought of as a table with "headers" being the top row and "attributes " being the second row.CityBuildingHeight (m)BostonCustom House Tower151Thealtitude mode(optional) defines the way the z-coordinate (height) is mapped. When no altitude mode is given, "CTG" is used as the default.CTG= Clamp to Ground. Ignores any altitude value and places the feature on the surface of the ground.RTG= Relative to Ground. Measures the altitude from the ground level directly below the coordinates.ABS= Absolute. Altitude relative to mean sea level.A point can optionally be stylized. Thestyle to use(optional) parameter is the name of the style to be applied to the point. A point's style is defined with thepoint_style()function.Optionally, the point can be set to be visible or not with thehidden(optional) parameter. SettinghiddentoTruewill hide the point on the map when the map first opens. The map user can make the point visible again in the map. Hide points when the data is to be included, but the data may clutter the map.  Points are visible by default.ExampleA point with no style applied.importkmlb# Define a point that marks the top of Boston's Custom House Tower# Defining the point's arguments ahead of defining the pointcoords=[-71.053568,42.359053,151]name='Custom House Tower'attribute_titles=['City','Building','Height (M)']attributes=['Boston','Custom House Tower','151']# Define the pointplacemark=kmlb.point(coords,name,attribute_titles,attributes,'RTG')Search POIDefines a KML point element from a POI or an address search.search_poi()search_poi(poi,name=None,headers=None,attributes=None,style_to_use=None,hidden=False):Parameters:Required ParametersParameterTypeDescriptionpoiStringThe string equivalent of what would be typed into a search bar to locate a POI or an address.nameStringThe name to be given to the point feature. The name will be used for labeling.Optional ParametersParameterTypeDescriptionnameStringThe name to be given to the point feature. The name will be used for labeling. If no name is provided, the 'poi' argument's value will be used as the point's name.headersListA list of the attribute titles for the point featureattributesListA list of properties for the point feature.style_to_useStringThe name of thepoint_style()to be used (Default =None).hiddenBoolA value ofTrueorFalsewhereFalsemeans that the point will be visible. (Default =False).ReturnReturnTypeDescriptionplacemarkObjectAn XML element representing a KML Placemark.ExampleCreate a point from a POI and an address.importkmlb# CREATE A POINT FROM A POIbos_common=kmlb.search_poi('Boston Common, Boston, MA')# CREATE A POINT FROM AN ADDRESSss=kmlb.search_poi('700 Atlantic Avenue, Boston, MA',name='South Station')# WRITE KML FILEkmlb.kml('Boston Landmarks',# KML name[bos_common,ss],# Featuresr'C:\Users\UserName\Desktop\KMLB_Tutorial.kml'# Export path)LineDefines a KML line element.line()line(coords,name,headers=None,attributes=None,altitude_mode="CTG",style_to_use=None,hidden=False,follow_terrain=True,extrude_to_ground=False)Parameters:Required ParametersParameterTypeDescriptioncoordsListA list of coordinate sets :[[X1, Y1, Z1], [X2, Y2, Z2]]nameStringThe name to be given to the line feature.Optional ParametersParameterTypeDescriptionheadersListA list of the attribute titles for the line featureattributesListA list of properties for the line feature.altitude_modeStringOne of the abbreviated altitude mode options:CTG,RTG,ABS(Default =CTG)style_to_useStringThe name of theline_style()to be used (Default =None).hiddenBoolA value ofTrueorTruewhereTruemeans that the point will be visible. (Default =True).follow_terrainBoolDetermines whether or not the line will follow terrain and curve of the Earth. (Default =True).extrude_to_groundBoolDetermines whether or not the vertices of the line are extruded toward the center of the Earth's center. (Default =False).cameraElementA KML 'LookAt' element. (Default =None)ReturnReturnTypeDescriptionplacemarkObjectAn XML element representing a KML Placemark.About a LineDefining aline()is very similar to defining apoint()with the main difference being how the coordinates (coords) argument is formatted prior to being passed to theline()function. A line is composed of two coordinates sets - a starting point and an ending point. A polyline is composed of three or more coordinates sets - a starting point, mid point/s, and an ending point. In the KMLB Package, theline()function can accept coordinate sets for both lines and polylines.To define a line, place two [X, Y, Z] coordinate sets within[]like so:line_coords=[[X1,Y1,Z1],[X2,Y2,Z2]]To define a polyline, place three or more coordinate sets within[]like so:polyline_coords=[[X1,Y1,Z1],[X2,Y2,Z2],[X3,Y3,Z3]]A line'sstyle to use(optional) parameter is the name of the style to be applied to the line. A line's style is defined with theline_style()function.If two vertices of a line or polyline are very far apart, the shortest distance between them, will be through the Earth. Likewise, if a mountain is between two vertices of a line, the line will go through the mountain rather than over it. To avoid having the mapped line go through the Earth(or any terrain that may be between vertices)keep thefollow terrain(optional) parameter set toTrue.If the line being mapped is elevated above the surface of the Earth, it is possible to fill the area below the line and above the Earth's surface with a color. If theextrude to ground(optional) parameter is set toTrue, theextrude_colordefined inlines_style()will be displayed.ExampleA polyline with no style applied.# Define a polyline that marks the path from Boston's Custom House Tower to the Boston Aquarium# Z-coord is set to zero since altitude mode will be 'CTG'coords=[[-71.053568,42.359053,0],[-71.053266,42.359099,0],[-71.053289,42.359289,0],[-71.050779,42.359672,0],[-71.050784,42.359200,0],[-71.050429,42.359002,0],[-71.049882,42.359063,0]]name='Path to Aquarium'attribute_titles=['City','Starting Point','Ending Point']attributes=['Boston','Custom House Tower','Boston Aquarium']# Define the lineplacemark=kmlb.line(coords,name,attribute_titles,attributes)PolygonDefines a KML polygon element.polygon()polygon(coords,name,headers=None,attributes=None,altitude_mode="CTG",style_to_use=None,hidden=False,follow_terrain=True,extrude_to_ground=False)Parameters:Required ParametersParameterTypeDescriptioncoordsListA list of coordinate sets that form rings (outer/inner rings).nameStringThe name to be given to the polygon feature.Optional ParametersParameterTypeDescriptionheadersListA list of the attribute titles for the polygon featureattributesListA list of properties for the polygon feature.altitude_modeStringOne of the abbreviated altitude mode options:CTG,RTG,ABS(Default =CTG)style_to_useStringThe name of thepolygon_style()to be used (Default =None).hiddenBoolA value ofTrueorTruewhereTruemeans that the point will be visible. (Default =True).follow_terrainBoolDetermines whether or not segments of the polygon will follow terrain and curve of the Earth. (Default =True).extrude_to_groundBoolDetermines whether or not the vertices of the polygon are extruded toward the center of the Earth's center. (Default =False).cameraElementA KML 'LookAt' element. (Default =None)ReturnReturnTypeDescriptionplacemarkObjectAn XML element representing a KML Placemark.About a PolygonApolygon()is defined by a singleouter ringand any number ofinner rings. Eachringis similar to a polyline, with the only difference being that the first and final coordinate set of the ring must match each other. The first and final coordinate sets of each ring need to match so that the polyline"closes"and forms a polygon.  In this way, a triangle will be defined by four vertices/coordinates sets. Each ring must contain at least three distinct coordinate sets with the first and last sets matching each other.Outer Ring: Forms the exterior boundary of a polygon. A polygon can only have one outer ring defined.Inner Ring: Forms an interior hole within a polygon's outer ring. A polygon can have any number of inner rings defined.A polygon is structured as follows:Polygon=[OuterRing,InnerRing1,InnerRing2,....]Inner rings are optional. The geometry of a polygon can be defined with only an outer ring like so:Polygon=[OuterRing]To define an outer or inner ring of a polygon, place at least four [X, Y, Z] coordinate sets within[]like so:ring_coords=[[X1,Y1,Z1],[X2,Y2,Z2],[X3,Y3,Z3],[X1,Y1,Z1]]To define a polygon without any interior holes:outer_ring=[[X1,Y1,Z1],[X2,Y2,Z2],[X3,Y3,Z3],[X1,Y1,Z1]]polygon_coords=[outering]To define a polygon with two interior holes:outer_ring=[[X1,Y1,Z1],[X2,Y2,Z2],[X3,Y3,Z3],[X1,Y1,Z1]]inner_ring1=[[X1,Y1,Z1],[X2,Y2,Z2],[X3,Y3,Z3],[X1,Y1,Z1]]inner_ring2=[[X1,Y1,Z1],[X2,Y2,Z2],[X3,Y3,Z3],[X1,Y1,Z1]]polygon_coords=[outering,inner_ring1,inner_ring2]ExampleA polygon with a hole and no style applied.# Define a polygon that outlines a portion of the Greenway with a hole for Rings Fountain# Define a polygon's parameters ahead of defining the polygon.# Z-coord is set to zero since altitude mode will be 'CTG'outer_ring=[[-71.052336,42.359485,0],[-71.052333,42.359422,0],[-71.052153,42.358787,0],[-71.052110,42.358758,0],[-71.052049,42.358746,0],[-71.051735,42.358797,0],[-71.051664,42.358840,0],[-71.051658,42.358890,0],[-71.051837,42.359527,0],[-71.051865,42.359551,0],[-71.051915,42.359569,0],[-71.052288,42.359514,0],[-71.052336,42.359485,0]]inner_ring=[[-71.052012,42.358864,0],[-71.051735,42.358910,0],[-71.051796,42.359109,0],[-71.052071,42.359065,0],[-71.052012,42.358864,0]]coords=[outer_ring,inner_ring]name='Rings Fountain on the Greenway'attribute_titles=['City','Park']attributes=['Boston','Greenway']# Define the polygonplacemark=kmlb.polygon(coords,name,attribute_titles,attributes)Style FunctionsStyles are used to customize the appearance of the features to be displayed on the map. Note: Once a style is defined, it can be used on as many applicable features as needed.Point StyleDefines a KML style that can be applied to point features.point_style()point_style(name,icon="http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png",color=('#ffff00',100),scale=1.2,label_color=('#ffffff',100),label_size=1.0)Parameters:Required ParametersParameterTypeDescriptionnameStringThe name to be given to the style. The name will be used to reference the defined style. Note: The name must be unique within the KML document.Optional ParametersThe default style of a point is a yellow circle with a white label.ParameterTypeDescriptioniconStringURL to the icon to use to mark the point with on the map.colorTupleDefines the color and opacity of the icon.  Color is defined with a hex color code. Opacity is defined with an integer between 0 and 100. Example:('#a2d402', 100)scaleFloatThe point marker's icon size. (Default = 1.2`)label_colorTupleDefines the color and opacity of the point's  label.label_sizeFloatText size of point's label. (Default = 1.0`)ReturnReturnTypeDescriptionstyleObjectAn XML element representing a KML style definition.About a Point's StyleEach defined style requires a name that is unique to the KML document being created. Other thanname, each  of the otherpoint_style()parameters are optional when creating a point style. The default style a yellow circle with a white label.ExampleA point with default style applied.# Define stylept_style=kmlb.point_style('Default Point Style')# Defining the point's arguments ahead of defining the pointcoords=[-71.053568,42.359053,151]name='Custom House Tower'attribute_titles=['City','Building','Height (M)']attributes=['Boston','Custom House Tower','151']# Define point using default style.placemark=kmlb.point(coords,name,attribute_titles,attributes,'RTG','Default Point Style')A point with a custom style applied.# Define a custom blue square stylept_style=kmlb.point_style('Blue Square','http://maps.google.com/mapfiles/kml/shapes/square.png',("#0251fc",100))# Point Argumentscoords=[-71.053568,42.359053,151]name='Custom House Tower'attribute_titles=['City','Building','Height (M)']attributes=['Boston','Custom House Tower','151']# Define point using default style.placemark=kmlb.point(coords,name,attribute_titles,attributes,'RTG','Blue Square')Line StyleDefines a KML style that can be applied to line features.line_style()line_style(name,color=('#ff0000',100),width=3.0,extrude_color=('#34c9eb',35))Parameters:Required ParametersParameterTypeDescriptionnameStringThe name to be given to the style. The name will be used to reference the defined style. Note: The name must be unique within the KML document.Optional ParametersThe default color of a line is red with a light transparent blue extrusion color.ParameterTypeDescriptioncolorTupleDefines the color and opacity of the line.  Color is defined with a hex color code. Opacity is defined with an integer between 0 and 100. Example:('#a2d402', 100)widthFloatLine thickness. (Default = 3.0`)extrude_colorTupleDefines the color and opacity of the area below the line. Note: Only displayed when theextrude_to_groundparameter of theline()function is set toTrueand and is only displayed for portions of the line that above the ground.ReturnReturnTypeDescriptionstyleObjectAn XML element representing a KML style definition.About a Line's StyleEach defined style requires a name that is unique to the KML document being created. Other thanname, each  of the otherline_style()parameters are optional when creating a line style. The default color of a line is red with a light transparent blue extrusion color.ExampleA polyline with a custom style applied.# Define a custom yellow line styleln_style=kmlb.line_style('Yellow Line',('#fcce02',100))# Line argumentscoords=[[-71.053568,42.359053,0],[-71.053266,42.359099,0],[-71.053289,42.359289,0],[-71.050779,42.359672,0],[-71.050784,42.359200,0],[-71.050429,42.359002,0],[-71.049882,42.359063,0]]name='Path to Aquarium'attribute_titles=['City','Starting Point','Ending Point']attributes=['Boston','Custom House Tower','Boston Aquarium']# Define the lineplacemark=kmlb.line(coords,name,attribute_titles,attributes,style_to_use='Yellow Line')Polygon StyleDefines a KML style that can be applied to polygon features.polygon_style()polygon_style(name,fill_color=('#03cafc',40),outline_color=('#fcdf03',100),outline_width=3.0)Parameters:Required ParametersParameterTypeDescriptionnameStringThe name to be given to the style. The name will be used to reference the defined style. Note: The name must be unique within the KML document.Optional ParametersThe default fill color of a polygon is a light transparent blue with a solid yellow outline.ParameterTypeDescriptionfill_colorTupleDefines the color and opacity of the polygon's fill color.  Color is defined with a hex color code. Opacity is defined with an integer between 0 and 100. Example:('#a2d402', 100)outline_colorTupleDefines the color and opacity of the polygon's outline color.outline_widthFloatOutline thickness. (Default = 1.0`)ReturnReturnTypeDescriptionstyleObjectAn XML element representing a KML style definition.About a Polygon's StyleEach defined style requires a name that is unique to the KML document being created. Other thanname, each  of the otherpolygon_style()parameters are optional when creating a polygon style. The default fill color of a polygon is a light transparent blue with a solid yellow outline.ExampleA polygon with a custom style applied.# Define a custom purple polygon stylepoly_style=kmlb.polygon_style('Purple Polygon',('#aaaaff',60),('#5500ff',100),4)# Polygon argumentsouter_ring=[[-71.052336,42.359485,0],[-71.052333,42.359422,0],[-71.052153,42.358787,0],[-71.052110,42.358758,0],[-71.052049,42.358746,0],[-71.051735,42.358797,0],[-71.051664,42.358840,0],[-71.051658,42.358890,0],[-71.051837,42.359527,0],[-71.051865,42.359551,0],[-71.051915,42.359569,0],[-71.052288,42.359514,0],[-71.052336,42.359485,0]]inner_ring=[[-71.052012,42.358864,0],[-71.051735,42.358910,0],[-71.051796,42.359109,0],[-71.052071,42.359065,0],[-71.052012,42.358864,0]]coords=[outer_ring,inner_ring]name='Rings Fountain on the Greenway'attribute_titles=['City','Park']attributes=['Boston','Greenway']# Define the polygonplacemark=kmlb.polygon(coords,name,attribute_titles,attributes,style_to_use='Purple Polygon')Folder FunctionCreate a FolderCreate a folder to hold loose KML geometry elements or other folders.folder()folder(name,loose_items,description='',collapsed=True,hidden=True)Parameters:Required ParametersParameterTypeDescriptionnameStringThe name of the folder to be created.loose_itemsListA list of loose items to include in the new folder.Optional ParametersThe default fill color of a polygon is a light transparent blue with a solid yellow outline.ParameterTypeDescriptiondescriptionStringA small body of descriptive text for the folder.collapsedBoolSets the folder to either be open or collapsed by default.False= Folder is open/expanded. (Default =True)hiddenBoolSets the visibility of a folder and its contents. A folder's visibility is ultimately determined by the visibility of the contents within. The default is to have folders set to hidden so that empty folders are not visible. If an item gets added to a folder and that item is set to be visible, the containing folder will become visible as well - even if the folder set to hidden. (Default =True)cameraElementA KML 'LookAt' element. (Default =None)ReturnReturnTypeDescriptionnew_folderObjectAn XML element representing a KML folder.ExampleCreate a folder to hold a point and line.# Defining the point's arguments ahead of defining the pointpt_coords=[-71.053568,42.359053,151]pt_name='Custom House Tower'pt_headers=['City','Building','Height (M)']pt_attributes=['Boston','Custom House Tower','151']# Define pointpt=kmlb.point(pt_coords,name,pt_headers,pt_attributes,'RTG')# Define a polyline that marks the path from Boston's Custom House Tower to the Boston Aquariumline_coords=[[-71.053568,42.359053,0],[-71.053266,42.359099,0],[-71.053289,42.359289,0],[-71.050779,42.359672,0],[-71.050784,42.359200,0],[-71.050429,42.359002,0],[-71.049882,42.359063,0]]ln_name='Path to Aquarium'lm_headers=['City','Starting Point','Ending Point']ln_attributes=['Boston','Custom House Tower','Boston Aquarium']# Define lineline=kmlb.line(line_coords,ln_name,ln_headers,ln_attributes)# Create folderf=kmlb.folder('Boston Path',[pt,line],'Point & Line')Look At FunctionCreate a 'LookAt' ElementCreate a folder to hold loose KLM geometry elements or other folders.look_at()look_at(coords,distance,azimuth,tilt,altitude_mode="ABS")When using thelook_at()function, the coordinates define a point (in 3D space) that the camera will be focused on. Distance is how far back from that point the camera will be. Azimuth is the horizontal angle from the camera to the point. Tilt is the camera's vertical angle away from nadir towards the point.Parameters:Required ParametersParameterTypeDescriptioncoordsListA coordinate set:[X, Y, Z]distanceFloatCamera distance in meters from the point specified by 'coords'.azimuthFloatThe direction that camera will face in degrees from 0-360.tiltFloatThe tilt of the camera towards the object. Values range from 0 to 90 degrees. A value of 0 degrees indicates viewing from directly above. A value of 90 degrees indicates viewing along the horizon.Optional ParametersThe default fill color of a polygon is a light transparent blue with a solid yellow outline.ParameterTypeDescriptionaltitude_modeStringAn abbreviated altitude mode ('CTG', 'RTG', 'ABS') (Default = 'ABS').ReturnReturnTypeDescriptionlookatElementA KML 'LookAt' elementExampleCreate a 'LookAt' element# Defining the point's arguments ahead of defining the pointpt_coords=[-71.053568,42.359053,151]pt_name='Custom House Tower'pt_headers=['City','Building','Height (M)']pt_attributes=['Boston','Custom House Tower','151']# Define a camera angle for pointpt_camera=kmlb.look_at(coords,210,50,100,'RTG')# Define point with camera anglept=kmlb.point(pt_coords,name,pt_headers,pt_attributes,'RTG',camera=pt_camera)Creating a KMLKMLCreate a folder to hold loose KLM geometry elements or other folders.kml()kml(name,features,path,description='',styles=None,collapsed=True)Parameters:Required ParametersParameterTypeDescriptionnameStringThe name of the KML. Note: this is not the KML's file name, but rather the name that will appear within the map.featuresListA list of feature to be written to the KML. The list of features can include points, lines, polygons, and folders.pathStringThe path to the folder where the KML file will be written to. Necessary folders will be created of they do not exist. The KML's file name is defined in the path. Note: The file path should end.kmlOptional ParametersThe default fill color of a polygon is a light transparent blue with a solid yellow outline.ParameterTypeDescriptiondescriptionStringA small body of descriptive text for the KML file.stylesListA list of styles to be written to and used within the KML.collapsedBoolSets the root KML folder to either be open or collapsed by default.False= Folder is open/expanded. (Default =True)cameraElementA KML 'LookAt' element. (Default =None)ReturnReturnTypeDescription------This function does not return anything.FULL EXAMPLEBringing Everything together to write a KML file.importkmlb# DEFINING STYLES# Define red triangle point stylept_style=kmlb.point_style('Red Triangle',# Point style name'http://maps.google.com/mapfiles/kml/shapes/triangle.png',# Icon to mark point with('#ff0000',100),# Icon color1.0)# Icon scale# Define a yellow line styleln_style=kmlb.line_style('Yellow Line',('#fcce02',100))# Define purple polygon stylepoly_style=kmlb.polygon_style('Purple Polygon',('#aaaaff',60),('#5500ff',100),4)# CREATING A POINTcoords=[-71.053568,42.359053,151]name='Custom House Tower'attribute_titles=['City','Building','Height (M)']attributes=['Boston','Custom House Tower','151']# Define a camera angle for pointpt_camera=kmlb.look_at(coords,100,210,50,'RTG')clock_tower=kmlb.point(coords,name,attribute_titles,attributes,'RTG','Red Triangle',pt_camera)# SEARCHING A POIaquarium=kmlb.search_poi("New England Aquarium")# CREATING A LINEcoords=[[-71.053266,42.359099,0],[-71.053311,42.359285,0],[-71.050779,42.359672,0],[-71.050784,42.359200,0],[-71.050429,42.359002,0],[-71.049882,42.359063,0]]name='Path to Aquarium'attribute_titles=['City','Starting Point','Ending Point']attributes=['Boston','Custom House Tower','Boston Aquarium']walking_path=kmlb.line(coords,name,attribute_titles,attributes,style_to_use='Yellow Line')# CREATING A POLYGONouter_ring=[[-71.052336,42.359485,0],[-71.052333,42.359422,0],[-71.052153,42.358787,0],[-71.052110,42.358758,0],[-71.052049,42.358746,0],[-71.051735,42.358797,0],[-71.051664,42.358840,0],[-71.051658,42.358890,0],[-71.051837,42.359527,0],[-71.051865,42.359551,0],[-71.051915,42.359569,0],[-71.052288,42.359514,0],[-71.052336,42.359485,0]]inner_ring=[[-71.052012,42.358864,0],[-71.051735,42.358910,0],[-71.051796,42.359109,0],[-71.052071,42.359065,0],[-71.052012,42.358864,0]]coords=[outer_ring,inner_ring]name='Rings Fountain on the Greenway'attribute_titles=['City','Park']attributes=['Boston','Greenway']greenway_park=kmlb.polygon(coords,name,attribute_titles,attributes,style_to_use='Purple Polygon')# ADD GEOMETRIES TO FOLDERf=kmlb.folder('Boston Shapes',[clock_tower,aquarium,walking_path,greenway_park],'Sample Shapes')# WRTIE KML FILEkmlb.kml('Created with KMLB',# KML name[f],# Features (Folder containing shapes)r'C:\Users\UserName\Desktop\KMLB_Tutorial.kml',# Export path'KML Tutorial Shapes',# KML Description[pt_style,ln_style,poly_style]# Custom styles)