使用 JAK 将时间添加到 Java 中的 KML 文件

Adding time to a KML file in Java using JAK

我正在尝试将时间添加到我的 KML 文件中,但我不知道如何添加。我知道根据格式我需要在坐标之前添加它但我找不到正确的命令..帮助将不胜感激 =) 这是我到目前为止的代码:

String time=filteredStrings.get(i).get(4);
String timestamp=TimeConvert(time); // a function to get the right time format
String Location=filteredStrings.get(i).get(1)+","+filteredStrings.get(i).get(0);    
    doc.createAndAddPlacemark().withName("point"+i).withOpen(Boolean.TRUE).createAndSetTimeStamp().addToObjectSimpleExtension(timestamp)
            .createAndSetPoint().addToCoordinates(Location);

createAndSetTimeStamp() 方法returns 时间戳对象不是地标,因此在创建时间戳后设置位置不起作用。

只需创建一个地标对象,然后在其上设置位置和时间。

    Placemark place =  doc.createAndAddPlacemark().withName("point1")
            .withOpen(Boolean.TRUE);
    place.createAndSetPoint().addToCoordinates(Location);
    place.createAndSetTimeStamp().withWhen("2017-11-22T00:00:00Z");