Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Either download Google Earth Pro, or use the web version. Your choice. Both load KML files, but you can 1 click open with desktop version. (not sure about web)
- https://www.google.com/earth/versions/#download-pro
- Prompt to figure out locations
- ```to get locations
- Ask me 5 questions to figure out locations on earth that I might enjoy seeing in a virtual earth. Ask creative questions, and return a list of locations in a format such as the following. The locations are not limited to cities, this is just the example format provided. Return as many locations that are fitting. [The last location doesn't have a comma, or a period trailing. It should end with a "}"]
- Wait for me to answer the questions before providing locations, put your ultimate reply in a code block.
- ----------------------------------
- {"name": "Singapore", "latitude": 1.282302, "longitude": 103.858528},
- {"name": "Hong Kong", "latitude": 22.396428, "longitude": 114.109497},
- {"name": "Seoul", "latitude": 37.566535, "longitude": 126.977969},
- {"name": "Taipei", "latitude": 25.032969, "longitude": 121.565418},
- {"name": "Shanghai", "latitude": 31.230390, "longitude": 121.473701},
- {"name": "Tokyo", "latitude": 35.689500, "longitude": 139.691700},
- {"name": "Kuala Lumpur", "latitude": 3.139003, "longitude": 101.686855},
- {"name": "Jakarta", "latitude": -6.175110, "longitude": 106.865039},
- {"name": "Bangkok", "latitude": 13.7563309, "longitude": 100.5017651},
- {"name": "Manila", "latitude": 14.5995124, "longitude": 120.9842195}
- ```
- Python: https://www.python.org/downloads/
- Use this command in command console `pip install simplekml` to instlal the simplekml lib
- This is the script to create the KML file for Google Earth. just replace your location data, and run the script. Then you should have a tour.kml you can open with Google Earth.
- ```python
- import simplekml
- # Create an array of cities
- locations = [
- # REPLACE BELOW THIS LINE WITH YOUR OWN DATA
- {"name": "Mt. Kilimanjaro", "latitude": -3.075833, "longitude": 37.353333},
- {"name": "Mt. Everest", "latitude": 27.988056, "longitude": 86.925278},
- {"name": "Yellowstone National Park", "latitude": 44.427963, "longitude": -110.588455},
- {"name": "Yosemite National Park", "latitude": 37.865101, "longitude": -119.538329},
- {"name": "Grand Canyon National Park", "latitude": 36.106980, "longitude": -112.112997},
- {"name": "Zhangjiajie National Forest Park", "latitude": 29.448747, "longitude": 110.489953},
- {"name": "Jiuzhaigou Valley", "latitude": 33.231680, "longitude": 103.847360},
- {"name": "Tromsø", "latitude": 69.649208, "longitude": 18.955324},
- {"name": "Banff National Park", "latitude": 51.178363, "longitude": -115.570769},
- {"name": "Serengeti National Park", "latitude": -1.402222, "longitude": 34.787222}
- # REPLACE ABOVE THIS LINE WITH YOUR OWN DATA.
- ]
- # DON'T CHANGE ANYTHING BELOW THIS LINE, UNLESS YOU KNOW WHAT YOU ARE DOING
- # Create a new KML object
- kml = simplekml.Kml()
- # Create a tour object
- tour = kml.newgxtour(name="City Tour")
- # Create a playlist object
- playlist = tour.newgxplaylist()
- # Add each city to the tour with a smooth transition
- for city in locations:
- camera = playlist.newgxflyto(gxduration=8.0)
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 1200
- camera.lookat.heading = 0
- camera.lookat.tilt = 0
- camera.lookat.range = 1200
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- camera = playlist.newgxflyto(gxduration=1.5)
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 50
- camera.lookat.heading = 0
- camera.lookat.tilt = 70
- camera.lookat.range = 1000
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- camera = playlist.newgxflyto(
- gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
- )
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 50
- camera.lookat.heading = 90
- camera.lookat.tilt = 70
- camera.lookat.range = 1000
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- camera = playlist.newgxflyto(
- gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
- )
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 50
- camera.lookat.heading = 180
- camera.lookat.tilt = 70
- camera.lookat.range = 1000
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- camera = playlist.newgxflyto(
- gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
- )
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 50
- camera.lookat.heading = 270
- camera.lookat.tilt = 70
- camera.lookat.range = 1000
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- camera = playlist.newgxflyto(
- gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
- )
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 50
- camera.lookat.heading = 360
- camera.lookat.tilt = 70
- camera.lookat.range = 1000
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- camera = playlist.newgxflyto(gxduration=1.5)
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 50
- camera.lookat.heading = 0
- camera.lookat.tilt = 0
- camera.lookat.range = 1000
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- camera = playlist.newgxflyto(gxduration=1.0)
- camera.lookat.latitude = city["latitude"]
- camera.lookat.longitude = city["longitude"]
- camera.lookat.altitude = 1200
- camera.lookat.heading = 0
- camera.lookat.tilt = 0
- camera.lookat.range = 1200
- camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
- # Save the KML file
- kml.save("tour.kml")
Advertisement
Add Comment
Please, Sign In to add comment