Guest User

Untitled

a guest
Feb 5th, 2023
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.10 KB | None | 0 0
  1. 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)
  2. https://www.google.com/earth/versions/#download-pro
  3.  
  4.  
  5. Prompt to figure out locations
  6. ```to get locations
  7. 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 "}"]
  8.  
  9. Wait for me to answer the questions before providing locations, put your ultimate reply in a code block.
  10. ----------------------------------
  11.  
  12. {"name": "Singapore", "latitude": 1.282302, "longitude": 103.858528},
  13. {"name": "Hong Kong", "latitude": 22.396428, "longitude": 114.109497},
  14. {"name": "Seoul", "latitude": 37.566535, "longitude": 126.977969},
  15. {"name": "Taipei", "latitude": 25.032969, "longitude": 121.565418},
  16. {"name": "Shanghai", "latitude": 31.230390, "longitude": 121.473701},
  17. {"name": "Tokyo", "latitude": 35.689500, "longitude": 139.691700},
  18. {"name": "Kuala Lumpur", "latitude": 3.139003, "longitude": 101.686855},
  19. {"name": "Jakarta", "latitude": -6.175110, "longitude": 106.865039},
  20. {"name": "Bangkok", "latitude": 13.7563309, "longitude": 100.5017651},
  21. {"name": "Manila", "latitude": 14.5995124, "longitude": 120.9842195}
  22. ```
  23.  
  24. Python: https://www.python.org/downloads/
  25.  
  26. Use this command in command console `pip install simplekml` to instlal the simplekml lib
  27.  
  28. 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.
  29. ```python
  30. import simplekml
  31.  
  32. # Create an array of cities
  33. locations = [
  34. # REPLACE BELOW THIS LINE WITH YOUR OWN DATA
  35. {"name": "Mt. Kilimanjaro", "latitude": -3.075833, "longitude": 37.353333},
  36. {"name": "Mt. Everest", "latitude": 27.988056, "longitude": 86.925278},
  37. {"name": "Yellowstone National Park", "latitude": 44.427963, "longitude": -110.588455},
  38. {"name": "Yosemite National Park", "latitude": 37.865101, "longitude": -119.538329},
  39. {"name": "Grand Canyon National Park", "latitude": 36.106980, "longitude": -112.112997},
  40. {"name": "Zhangjiajie National Forest Park", "latitude": 29.448747, "longitude": 110.489953},
  41. {"name": "Jiuzhaigou Valley", "latitude": 33.231680, "longitude": 103.847360},
  42. {"name": "Tromsø", "latitude": 69.649208, "longitude": 18.955324},
  43. {"name": "Banff National Park", "latitude": 51.178363, "longitude": -115.570769},
  44. {"name": "Serengeti National Park", "latitude": -1.402222, "longitude": 34.787222}
  45. # REPLACE ABOVE THIS LINE WITH YOUR OWN DATA.
  46. ]
  47.  
  48. # DON'T CHANGE ANYTHING BELOW THIS LINE, UNLESS YOU KNOW WHAT YOU ARE DOING
  49.  
  50. # Create a new KML object
  51. kml = simplekml.Kml()
  52.  
  53. # Create a tour object
  54. tour = kml.newgxtour(name="City Tour")
  55.  
  56. # Create a playlist object
  57. playlist = tour.newgxplaylist()
  58.  
  59. # Add each city to the tour with a smooth transition
  60. for city in locations:
  61. camera = playlist.newgxflyto(gxduration=8.0)
  62. camera.lookat.latitude = city["latitude"]
  63. camera.lookat.longitude = city["longitude"]
  64. camera.lookat.altitude = 1200
  65. camera.lookat.heading = 0
  66. camera.lookat.tilt = 0
  67. camera.lookat.range = 1200
  68. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  69.  
  70. camera = playlist.newgxflyto(gxduration=1.5)
  71. camera.lookat.latitude = city["latitude"]
  72. camera.lookat.longitude = city["longitude"]
  73. camera.lookat.altitude = 50
  74. camera.lookat.heading = 0
  75. camera.lookat.tilt = 70
  76. camera.lookat.range = 1000
  77. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  78.  
  79. camera = playlist.newgxflyto(
  80. gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
  81. )
  82. camera.lookat.latitude = city["latitude"]
  83. camera.lookat.longitude = city["longitude"]
  84. camera.lookat.altitude = 50
  85. camera.lookat.heading = 90
  86. camera.lookat.tilt = 70
  87. camera.lookat.range = 1000
  88. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  89.  
  90. camera = playlist.newgxflyto(
  91. gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
  92. )
  93. camera.lookat.latitude = city["latitude"]
  94. camera.lookat.longitude = city["longitude"]
  95. camera.lookat.altitude = 50
  96. camera.lookat.heading = 180
  97. camera.lookat.tilt = 70
  98. camera.lookat.range = 1000
  99. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  100.  
  101. camera = playlist.newgxflyto(
  102. gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
  103. )
  104. camera.lookat.latitude = city["latitude"]
  105. camera.lookat.longitude = city["longitude"]
  106. camera.lookat.altitude = 50
  107. camera.lookat.heading = 270
  108. camera.lookat.tilt = 70
  109. camera.lookat.range = 1000
  110. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  111.  
  112. camera = playlist.newgxflyto(
  113. gxduration=15.0, gxflytomode=simplekml.GxFlyToMode.smooth
  114. )
  115. camera.lookat.latitude = city["latitude"]
  116. camera.lookat.longitude = city["longitude"]
  117. camera.lookat.altitude = 50
  118. camera.lookat.heading = 360
  119. camera.lookat.tilt = 70
  120. camera.lookat.range = 1000
  121. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  122.  
  123. camera = playlist.newgxflyto(gxduration=1.5)
  124. camera.lookat.latitude = city["latitude"]
  125. camera.lookat.longitude = city["longitude"]
  126. camera.lookat.altitude = 50
  127. camera.lookat.heading = 0
  128. camera.lookat.tilt = 0
  129. camera.lookat.range = 1000
  130. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  131.  
  132. camera = playlist.newgxflyto(gxduration=1.0)
  133. camera.lookat.latitude = city["latitude"]
  134. camera.lookat.longitude = city["longitude"]
  135. camera.lookat.altitude = 1200
  136. camera.lookat.heading = 0
  137. camera.lookat.tilt = 0
  138. camera.lookat.range = 1200
  139. camera.lookat.altitudemode = simplekml.AltitudeMode.relativetoground
  140. # Save the KML file
  141. kml.save("tour.kml")
Advertisement
Add Comment
Please, Sign In to add comment