我在我的应用程序中添加标记GoogleMaps
,我的标记总是在街道上。例如,我在地图上有超过 2 个标记,我需要根据街道在它们之间绘制最佳路线。是否有任何服务可以帮助我,或者我需要创建我自己的算法?到目前为止,我使用Google Elevation API
and进行了一些工作Google Direction API
,但现在我需要Google Roads API
, 来找到点之间的最佳道路?它必须与我的需求相似。
问问题
814 次
1 回答
2
考虑使用以下库:https ://github.com/akexorcist/Android-GoogleDirectionLibrary
GoogleDirection.withServerKey("YOUR_SERVER_API_KEY")
.from(new LatLng(37.7681994, -122.444538))
.to(new LatLng(37.7749003,-122.4034934))
.avoid(AvoidType.FERRIES)
.avoid(AvoidType.HIGHWAYS)
.execute(new DirectionCallback() {
@Override
public void onDirectionSuccess(Direction direction, String rawBody) {
if(direction.isOK()) {
// Do something
} else {
// Do something
}
}
@Override
public void onDirectionFailure(Throwable t) {
// Do something
}
});
摇篮
compile 'com.akexorcist:googledirectionlibrary:1.0.5'
于 2017-03-01T20:23:16.727 回答