Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lineStrings = SpliceLists(consolidatedStrings)
doc = KML.kml(
KML.Document(
KML.name('US-Canada Border'),
KML.Style(
KML.LineStyle(
KML.color('ff0000ff'),
KML.width(5)
),
id="stl"
),
KML.Style(
KML.LineStyle(
KML.color('0000ffff'),
KML.width(15)
),
id="stlx"
),
)
)
for ls in lineStrings:
print 'coordinates=[%s ... %s] (%d)' % (ls[0], ls[len(ls)-1], len(ls))
print 'Have latitude %s' % ls[0].split(',')[1]
if float(ls[0].split(',')[1]) > 50:
geo_name = 'AK-CA Boundary'
else:
geo_name = 'CONUS-CA Boundary'
pm = KML.Placemark(
KML.name('%s' % geo_name),
conusArea = SPolygon(conusBorder)
area = SPolygon(latLng)
zix = area.intersection(conusArea)
zones[name] = [zix]
# 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'),
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:
place_marker=(KML.Placemark(
KML.styleUrl("#star"),
doc = KML.kml(
KML.Document(
KML.Name("GPS of the images"),
KML.Style(
KML.IconStyle(
KML.scale(0.4),
KML.Icon(
KML.href(
"http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png")
),
),
id=style_dot,
),
KML.Style(
KML.LineStyle(
KML.color('7f0000ff'),
KML.width(6),
GX.labelVisibility('1'),
),
id=style_path
)
)
)
# create points
for i, gps in enumerate(self.tagged_gps):
ii = i + 1
doc.Document.append(
KML.Placemark(
KML.styleUrl('#{0}'.format(style_dot)),
KML.Point(
KML.extrude(True),
)
))
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"
)
)
)
AddPlacemarkAndZone(doc.Document, radar_sites[0])
AddPlacemarkAndZone(doc.Document, radar_sites[1])
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) +
" reportnum: " + network.reportnum))
for shot_line in network.shot_lines:
def create_reference_point_element(inps, lats, lons, ts_obj):
"""Create reference point element"""
colormap = mpl.cm.get_cmap(inps.colormap) # set colormap
norm = mpl.colors.Normalize(vmin=inps.vlim[0], vmax=inps.vlim[1])
ref_yx = (int(ts_obj.metadata['REF_Y']), int(ts_obj.metadata['REF_X']))
ref_lalo = (lats[ref_yx[0], ref_yx[1]], lons[ref_yx[0], ref_yx[1]])
ref_point = KML.Placemark(
KML.Style(
KML.IconStyle(
KML.color(get_hex_color(0.0, colormap, norm)),
KML.scale(1.),
KML.Icon(
KML.href("{}".format(os.path.basename(inps.star_file)))
)
)
),
KML.description("Reference point <br> \n <br> \n" +
get_description_string(ref_lalo, ref_yx, 0.00, 0.00, 0.00, 1.00)
),
KML.Point(
KML.coordinates("{}, {}".format(ref_lalo[1], ref_lalo[0]))
)
)
return ref_point