How to use the pykml.factory.KML_ElementMaker.Style 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
def write_kml(list_of_networks):
            
            doc=KML.Document(
                KML.name("PH5 Events"),
                KML.Style(
                    KML.IconStyle(
                        KML.color('FF1400FF'),
                        KML.scale('1.25'),
                        KML.Icon(
                                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:
github Wireless-Innovation-Forum / Spectrum-Access-System / src / data / legacy / 3650_3700_radar_sites.py View on Github external
KML.LinearRing(
      KML.coordinates(coordinates)
    )
  ))
  doc.append(zone)


# Find the directory of this script.
dir = os.path.dirname(os.path.realpath(__file__))
rootDir = os.path.dirname(os.path.dirname(dir))
fccDir = os.path.join(os.path.join(rootDir, 'data'), 'fcc')

doc = KML.kml(
  KML.Document(
    KML.name('3650-3700 Radar Sites'),
    KML.Style(
      KML.LineStyle(
        KML.color('ff00ff00'),
        KML.width(2)
      ),
      KML.PolyStyle(
        KML.color('66006600')
      ),
      id="ts"
    ),
    KML.Style(
      KML.color('ff00ff00'),
      id="pm"
    )
  )
)
github NCPP / ocgis / src / openclimategis / util / ncconv / experimental / ocg_converter.py View on Github external
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(
              KML.LineStyle(
                KML.color('ff0000ff'),
                KML.width('2'),
              ),
              KML.PolyStyle(
                KML.color('400000ff'),
              ),
              id="style-normal",
            ),
            KML.Style(
              KML.LineStyle(
                KML.color('ff00ff00'),
                KML.width('4'),
              ),
              KML.PolyStyle(
                KML.color('400000ff'),
github arthur-e / unmixing / unmixing / lsma.py View on Github external
if any(map(lambda x: x[0] == 0 and x[1] == 0, self.get_idx())):
            print('Warning: Target endmember chosen at (0,0)')
            print('One or more endmembers may be photometric shade')

        if data_dict is None:
            data_dict = {
                'wavelength': range(1, len(coords) + 1),
                'wavelength units': 'MNF Component',
                'z plot titles': ['', '']
            }

        ico = 'http://maps.google.com/mapfiles/kml/paddle/%i.png'
        pmarks = []
        for i, pair in enumerate(coords):
            pmarks.append(KML.Placemark(
                KML.Style(
                    KML.IconStyle(
                        KML.Icon(KML.href(ico % (i + 1))))),
                KML.name(data_dict['wavelength units'] + ' %d' % (i + 1)),
                KML.Point(KML.coordinates('%f,%f' % pair))))

        doc = KML.kml(KML.Folder(*pmarks))
        with open(path, 'wb') as source:
            source.write(etree.tostring(doc, pretty_print=True))
github Wireless-Innovation-Forum / Spectrum-Access-System / src / data / usborder.py View on Github external
KML.PolyStyle(
        KML.color('66000066')
      ),
      id="stl"
    ),
    KML.Style(
      KML.LineStyle(
        KML.color('ff00ffff'),
        KML.width(4)
      ),
      KML.PolyStyle(
        KML.color('00006666')
      ),
      id="stlx"
    ),
    KML.Style(
      KML.LineStyle(
        KML.color('ff00ff00'),
        KML.width(2)
      ),
      KML.PolyStyle(
        KML.color('00006666')
      ),
      id="stly"
    ),
  )
)

num = 1
for ls in lineStrings:
  print 'Have final poly len=%d' % len(ls)
  geo_name = '%d' % num
github PIC-IRIS / PH5 / ph5 / clients / ph5toexml.py View on Github external
def write_kml(list_of_networks):
            has_data = False

            doc = KML.Document(
                KML.name("PH5 Events"),
                KML.Style(
                    KML.IconStyle(
                        KML.color('FF1400FF'),
                        KML.scale('1.25'),
                        KML.Icon(
                            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) +
github clawpack / visclaw / src / python / visclaw / plotpages.py View on Github external
# Create high level 'levels.kml' file
    level_files = []
    doc_levels = []
    styles = []

    # Assume that if we are using ForestClaw, that we have set maxlevels correctly
    for i in range(0,maxlevels+1-level_base):
        level_file_name = "level_" + str(i+level_base).rjust(2,'0')
        level_files.append(level_file_name)

        # KML Document for each level
        doc_levels.append(KML.kml(KML.Document()))

        # Styles for levels
        styles.append(KML.Style(
            KML.LineStyle(
                KML.color(colors[i % len(colors)]),   # cycle through colors
                KML.width(width)),
            KML.PolyStyle(KML.color("00000000")),
            id="patchborder"))


    # Create individual level files in subdirectories

    doc_frames = [[0 for j in range(numframes)] for i in range(0,maxlevels+1-level_base)]
    for j in range(0,numframes):
        frameno = framenos[j]
        for i in range(0,maxlevels+1-level_base):
            frame_file_name = level_files[i] + "_" + str(frameno).rjust(4,'0') + ".kml"
            if i == 0:
                vis = 0  # Don't show first level
github Wireless-Innovation-Forum / Spectrum-Access-System / src / data / protection_zones.py View on Github external
# Create the KML document skeleton
doc = KML.kml(
  KML.Document(
    KML.name('Protection Zones'),
    KML.Style(
      KML.LineStyle(
        KML.color('ff0000ff'),
        KML.width(2)
      ),
      KML.PolyStyle(
        KML.color('66000066')
      ),
      id="stl"
    ),
    KML.Style(
      KML.LineStyle(
        KML.color('ff00ffff'),
        KML.width(4)
      ),
      KML.PolyStyle(
        KML.color('00006666')
      ),
      id="stlx"
    ),
    KML.Style(
      KML.LineStyle(
        KML.color('ff00ff00'),
        KML.width(2)
      ),
      KML.PolyStyle(
        KML.color('00006666')
github Wireless-Innovation-Forum / Spectrum-Access-System / src / data / resample_uscabdry.py View on Github external
print '  segment %s: Before %d After %d' % (
      name, len(ls.xy[0]), len(uscabdry_fine[name].xy[0]))


# Build the output KML
doc = KML.kml(
  KML.Document(
    KML.name('US-Canada Border'),
    KML.Style(
      KML.LineStyle(
        KML.color('ffff00ff'),
        KML.width(3)
      ),
      id="stl"
    ),
    KML.Style(
      KML.LineStyle(
        KML.color('00ffff00'),
        KML.width(15)
      ),
      id="stlx"
    ),
  )
)

def FormatLonLat(lon, lat):
  """Format lat/lon like original KML."""
  # This insure exact formatting as original KML. Basically if outputing
  # the original KML, will produce exact same file.
  if abs(lon) >= 100:
    return '%s,%s,0' % (('%.13f' % lon).rstrip('0').rstrip('.'),
                        ('%.14f' % lat).rstrip('0').rstrip('.'))
github clawpack / visclaw / src / python / visclaw / plotpages.py View on Github external
event_time = plotdata.kml_starttime
            tz = plotdata.kml_tz_offset
            frameno = framenos[-1]
            t2_slider = min([t2,frametimes[frameno]])   # Don't show times like 1e+9
            sbegin, send = kmltools.kml_timespan(t1,t2_slider,event_time,tz)
            TS_region = KML.TimeSpan(
                KML.begin(sbegin),
                KML.end(send))
            c = TS_region.getchildren()
            tsbegin = c[0]
            tsend = c[1]

            # Style for this region
            pathstr = "Path_region_%02d" % rnum
            doc_regions.Document.append(
                KML.Style(
                    KML.LineStyle(
                        KML.color(box_color),
                        KML.width(width)),
                    KML.PolyStyle(KML.color("000000")),
                    KML.BalloonStyle(deepcopy(balloon_text)),
                    id=pathstr))

            # Description for Places panel
            snippet_str = \
                "<b><pre>" + \
                "minlevel = %i, maxlevel = %i\n" % (minlevel,maxlevel) + \
                "t1 = %g, t2 = %g\n" % (t1,t2) +\
                "\n" + \
                "From (UTC) : %s\n" % tsbegin + \
                "To   (UTC) : %s\n" % tsend + \
                "</pre></b>"