Last active
February 21, 2016 04:59
-
-
Save wulfgarpro/e1c49f4fd53ae0e48b2d to your computer and use it in GitHub Desktop.
cgi script in python to generate kml LineString with LineStyle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import random | |
lat_a = random.randrange(35, 40) | |
lon_a = random.randrange(-120, -112) | |
lat_b = random.randrange(35, 40) | |
lon_b = random.randrange(-120, -112) | |
kml = ( | |
'<?xml version="1.0" encoding="UTF-8"?>' | |
'<kml xmlns="http://www.opengis.net/kml/2.2">' | |
' <Folder>' | |
' <Style id="SectionalRed">' | |
' <IconStyle>' | |
' <Icon>' | |
' </Icon>' | |
' </IconStyle>' | |
' <LabelStyle>' | |
' <color>ff0000ff</color>' | |
' </LabelStyle>' | |
' <LineStyle>' | |
' <color>ff0000ff</color>' | |
' <width>2.5</width>' | |
' </LineStyle>' | |
' </Style>' | |
' <Placemark>' | |
' <name>Random LineString with a Style</name>' | |
' <styleUrl>#SectionalRed</styleUrl>' | |
' <LineString>' | |
' <tessellate>1</tessellate>' | |
' <coordinates>' | |
' %d,%d,0' | |
' %d,%d,0' | |
' </coordinates>' | |
' </LineString>' | |
' </Placemark>' | |
' </Folder>' | |
'</kml>' | |
) % (lon_a,lat_a,lon_b,lat_b) | |
print 'Content-Type: application/vnd.google-earth.kml+xml\n' | |
print kml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment