gpt4 book ai didi

java - 映射经度和纬度

转载 作者:行者123 更新时间:2023-12-02 04:41:31 25 4
gpt4 key购买 nike

所以我有多个船舶对象,每艘船都存储了一系列相关的经度和纬度坐标,显示其路线。

例如。

[Longitude: 28.780815 Latitude: 60.259568
, Longitude: 28.780402 Latitude: 60.259393
, Longitude: 28.780585 Latitude: 60.259897
, Longitude: 28.78109 Latitude: 60.259785
, Longitude: 28.780408 Latitude: 60.259422
, Longitude: 28.781125 Latitude: 60.259893
, Longitude: 28.780835 Latitude: 60.259447
]

我的希望是以某种方式在 map 上绘制每艘船的坐标,以全面了解船舶的路径。
使用 java[eclipse],我希望创建坐标的图形映射,但在尝试找到一个好的库/工具来执行此操作时遇到问题。

最佳答案

尝试 kml 文件。

BufferedWriter out = new BufferedWriter(fstream); 
out.write("<kml>");
out.write("<Folder>");

out.write("<Placemark>");
out.write("<name>"+entry.getKey()+"</name>");
out.write("<LineString>");
out.write("<extrude>1</extrude>");
out.write("<tessellate>1</tessellate>");
out.write("<altitudeMode>clampToGround</altitudeMode>");
out.write("<coordinates>");
for(int i=0; i<entry.getValue().getCoordinates().size(); i++){ //path creation
out.write(entry.getValue().getCoordinates().get(i).getLongitude()+","+
entry.getValue().getCoordinates().get(i).getLatitude()+" ");
}
out.write("</coordinates>");
out.write("</LineString>");
out.write("</Placemark>");

for(int j=0; j<entry.getValue().getCoordinates().size(); j++){ //point creation
out.write("<Placemark>");
out.write("<name>"+entry.getValue().getCoordinates().get(j).coordinates()+"</name>");
out.write("<tessellate>1</tessellate>");
out.write("<altitudeMode>clampToGround</altitudeMode>");
out.write("<Point>");
out.write("<coordinates>");
out.write(entry.getValue().getCoordinates().get(j).getLongitude()+","+
entry.getValue().getCoordinates().get(j).getLatitude());
out.write("</coordinates>");
out.write("</Point>");
out.write("</Placemark>");
}

out.write("</Folder>");
out.write("</kml>");
out.close();
}

关于java - 映射经度和纬度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30129927/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com