我发现 Google map 提供了 PolylineOptions,但我没能为 Osmdroid 找到任何东西。
如果有人可以通过示例提出解决方案,那将非常有帮助。
最佳答案
您可能无法绘制真正的曲线,但您应该能够创建看起来像弯曲的多段线。折线由不弯曲的直线段组成。
您提到的 Google Map API 似乎也只支持没有曲线的多段线。参见 Google Map documentation
A Polyline is a series of connected line segments that can form any shape you want and can be used to mark paths and routes on the map.
Osmdroid 库支持折线和多边形。详情可见the Osmdroid documentation .
您可以创建 Polyline轻松:
List<GeoPoint> geoPoints = new ArrayList<>();
geoPoints.add(start);
//... add other points that should form the curve
geoPoints.add(end);
//add your points here
Polyline line = new Polyline(); //see note below!
line.setPoints(geoPoints);
map.getOverlayManager().add(line);
棘手的部分是计算两个已知坐标之间的点。
关于android - 如何使用 Osmdroid 库在两个坐标之间绘制曲线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54502178/