Google Earth KML

How do you associate cities with a curve (line) in kml for Google Earth?

+2


a source to share


1 answer


First, since you are on SO, I am assuming you are asking in terms of KML, not just a desktop application. You will need to have the coordinates of two cities. Then you will create a kml document following from the docs using your coordinates in the coordinate element (note that you don't need a "LookAt", but it will take your camera to the appropriate area):

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
  <name>LineString.kml</name>
  <open>1</open>
  <LookAt>
    <longitude>-122.36415</longitude>
    <latitude>37.824553</latitude>
    <altitude>0</altitude>
    <range>150</range>
    <tilt>50</tilt>
    <heading>0</heading>
  </LookAt>
  <Placemark>
    <name>unextruded</name>
    <LineString>
      <extrude>1</extrude>
      <tessellate>1</tessellate>
      <coordinates>
        -122.364383,37.824664,0 -122.364152,37.824322,0 
      </coordinates>
    </LineString>
  </Placemark>
  <Placemark>
    <name>extruded</name>
    <LineString>
      <extrude>1</extrude>
      <tessellate>1</tessellate>
      <altitudeMode>relativeToGround</altitudeMode>
      <coordinates>
        -122.364167,37.824787,50 -122.363917,37.824423,50 
      </coordinates>
    </LineString>
  </Placemark>
</Document>
</kml>

      



If you don't have city heights, leave those and remember to set the heightitudeMode to "clampToGround" and the tesselate is probably "1" (which means true). If you forget about it, your lines will disappear underground.

+3


a source







All Articles