Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Note: this deep copy is for debugging purposes: to add the source data
# to the output KML file for comparison to the derived data.
coordx = copy.deepcopy(coordinateLists)
consolidatedStrings = ConsolidateLists(coordinateLists)
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]
))
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])
AddPlacemarkAndZone(doc.Document, radar_sites[2])
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')
),
id="stly"
),
),
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'),
),
KML.BalloonStyle(
KML.text(('
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'),
),
id="style-highlight",
),
#Time Folders will be appended here
),
)
try:
s = db.Session()
for time in s.query(db.Time).all():
# create a folder for the time
timefld = KML.Folder(
# KML.Style(
# Resample the LineStrings
uscabdry_fine = {}
for name, ls in uscabdry.items():
uscabdry_fine[name] = ResampleUsCanadaBorderLineString(ls, step_meters)
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
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
else:
vis = 1
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),
KML.altitudeMode('absolute'),