auto sized = newClusterSegmentList.size();
StringBuffer sb;
Writer<StringBuffer> writer(sb);
writer.StartObject();
writer.String("type");
writer.String("FeatureCollection");
writer.String("features");
writer.StartArray();
for(auto &newcluster : newClusterSegmentList)
{
adjustCoord.setConvertFlag(COORD_CONVERT_FALG_ENU_TO_WGS84);
newcluster._newGeometry->apply_rw(adjustCoord);
writer.StartObject();
writer.String("type");
writer.String("Feature");
writer.String("geometry");
writer.StartObject();
writer.String("type");
writer.String("LineString");
writer.String("coordinates");
writer.StartArray();
// 获取 LineString 对象中的坐标
auto coordinates = newcluster._newGeometry->getCoordinates();
for (size_t i = 0; i < coordinates->getSize(); ++i)
{
const geos::geom::Coordinate& coord = coordinates->getAt(i);
writer.StartArray();
writer.Double(coord.x);
writer.Double(coord.y);
writer.Double(coord.z);
writer.EndArray();
}
writer.EndArray();
writer.EndObject();
writer.EndObject();
}
writer.EndArray();
writer.EndObject();
std::string path = "/media/linux/mydisk/tool/jsonDataCollect/boundary_fit_width/newclustercenterline/" + curClusterId +std::string(".geojson");//curClusterId
std::ofstream out;
out.open(path.c_str(), std::ios::out);
out << sb.GetString();
out.close();
geo几何 写入 geojson
最新推荐文章于 2024-05-23 17:21:42 发布