How to use the pykml.factory.KML_ElementMaker.description function in pykml

To help you get started, we’ve selected a few pykml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PIC-IRIS / PH5 / webservices / ph5toexml.py View on Github external
KML.href('http://maps.google.com/mapfiles/kml/shapes/open-diamond.png')
                                )
                            ),
                                id = 'star'
                        ),                
                )
            
            for network in list_of_networks:
                network_folder=KML.Folder(KML.name("Network Code: "+str(network.code)+" reportnum: "+network.reportnum))
                for shot_line in network.shot_lines:
                    folder = KML.Folder(KML.name("ShotLine "+str(shot_line.name[-3:])))
                    for shot in shot_line.shots:
                        place_marker=(KML.Placemark(
                            KML.styleUrl("#star"),
                            KML.name(network.code+'.'+str(shot.shot_id)),
                            KML.description('Shot size: '+str(shot.mag)+' '+shot.mag_units+'\n Shot Time: '+shot.start_time+'\n\n'+shot.description),
                            KML.Point(
                                KML.coordinates(str(shot.lon)+','+str(shot.lat)+','+str(shot.elev))
                                )
                        ))
                        folder.append(place_marker)
                    network_folder.append(folder)
                doc.append(network_folder)
            
            target = open(outfile, 'w')    
            target.write(etree.tostring(etree.ElementTree(doc),pretty_print=True))
            return
github NCPP / ocgis / ocgis_merge / src / openclimategis / util / ncconv / experimental / ocg_converter / kml.py View on Github external
url=url,
            url_kmz=url.replace('.kml', '.kmz'),
            url_shz=url.replace('.kml', '.shz'),
            url_csv=url.replace('.kml', '.csv'),
            url_json=url.replace('.kml', '.geojson'),
        )
        ##### TODO: build linked urls on the fly
        #from piston.emitters import Emitter
        #Emitter.EMITTERS.keys()
        #['xml', 'sqlite', 'nc', 'shz', 'kml', 'kcsv', 'django', 'json', 'html', 'meta', 'lshz', 'csv', 'pickle', 'kmz']

        doc = KML.kml(
          KML.Document(
            KML.name('Climate Simulation Output'),
            KML.open(1),
            KML.description(description),
            KML.snippet(
                '<i>Click for metadata!</i>',
                maxLines="2",
            ),
            KML.StyleMap(
              KML.Pair(
                KML.key('normal'),
                KML.styleUrl('#style-normal'),
              ),
              KML.Pair(
                KML.key('highlight'),
                KML.styleUrl('#style-highlight'),
              ),
              id="smap",
            ),
            KML.Style(
github pykml / pykml / src / examples / Tours / example_spline_camera.py View on Github external
def create_camera_model_placemark(location):
    
    pm = KML.Placemark(
        KML.description(
            ''
            ''
            ''
            ''
            ''
            ''
            ''
            '<table border="1"><tbody><tr><th>latitude</th><td>{lat}</td></tr><tr><th>longitude</th><td>{lon}</td></tr><tr><th>altitude</th><td>{alt}</td></tr><tr><th>heading</th><td>{head}</td></tr><tr><th>tilt</th><td>{tilt}</td></tr><tr><th>roll</th><td>{roll}</td></tr></tbody></table>'.format(
                lat=location['loc'].latitude,
                lon=location['loc'].longitude,
                alt=location['loc'].altitude,
                head=location['loc'].heading,
                tilt=location['loc'].tilt,
                roll=location['loc'].roll,
            )
        ),
github insarlab / MintPy / mintpy / save_kmz_timeseries.py View on Github external
style = KML.Style(
                        KML.IconStyle(
                            KML.color(get_hex_color(vc, colormap, norm)),
                            KML.scale(0.5),
                            KML.Icon(KML.href("{}".format(dot_file)))
                        )
                    )

                    # 2.3.2 Create KML point element
                    point = KML.Point(KML.coordinates("{},{}".format(lon, lat)))

                    js_data_string = generate_js_datastring(dates, inps.dygraph_file, num_date, ts)

                    # 2.3.3 Create KML description element
                    stats_info = get_description_string((lat, lon), (row, col), v, vstd, ts[-1], tcoh=tcoh)
                    description = KML.description(stats_info, js_data_string)

                    # 2.3.4 Crate KML Placemark element to hold style, description, and point elements
                    placemark = KML.Placemark(style, description, point)

                    # 2.3.5 Append each placemark element to the KML document object
                    data_folder.append(placemark)

        # 2.4 Append data folder to KML document
        kml_document.append(data_folder)

        # 2.5 Append KML document to list of regionalized documents
        region_docs.append(kml_document)

    return region_docs
github PIC-IRIS / PH5 / ph5 / clients / ph5toexml.py View on Github external
id='star'
                ),
            )

            for network in list_of_networks:
                network_folder = KML.Folder(KML.name(
                    "Network Code: " + str(network.code) +
                    " reportnum: " + network.reportnum))
                for shot_line in network.shot_lines:
                    folder = KML.Folder(
                        KML.name("ShotLine " + str(shot_line.name[-3:])))
                    for shot in shot_line.shots:
                        place_marker = (KML.Placemark(
                            KML.styleUrl("#star"),
                            KML.name(network.code + '.' + str(shot.shot_id)),
                            KML.description('Shot size: ' +
                                            str(shot.mag) +
                                            ' ' +
                                            shot.mag_units +
                                            '\n Shot Time: ' +
                                            shot.start_time +
                                            '\n\n' +
                                            shot.description),
                            KML.Point(
                                KML.coordinates(
                                    str(shot.lon) + ',' + str(shot.lat) + ',' +
                                    str(shot.elev))
                            )
                        ))
                        folder.append(place_marker)
                        has_data = True
                    network_folder.append(folder)
github pykml / pykml / src / pykml / util.py View on Github external
'Longitude field ({0}) was not found in the CSV file '
            'column names {1}'.format(longitude_field,csvdoc.fieldnames)
        )    
    for row in csvdoc:
        pm = KML.Placemark()
        if row.has_key(name_field):
            pm.append(
                KML.name(clean_xml_string(row[name_field]))
            )
        if row.has_key(snippet_field):
            pm.append(
                KML.Snippet(clean_xml_string(row[snippet_field]),maxLines="2")
            )
        if row.has_key(description_field):
            pm.append(
                KML.description(clean_xml_string(row[description_field]))
            )
        else:
            desc = '