用于路线规划导航的免费 SDK

发布于 2024-12-21 20:22:18 字数 1539 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

傲世九天 2024-12-28 20:22:18

MapQuest 有一套很好的免费服务和 SDK 可供使用。它们包括方向和许多其他导航功能。

根据我的所见和尝试,它们是最好的,对您在应用程序或网络上的使用没有任何限制。

查看此处

更新(基于评论):

有几个这取决于你正在努力做什么,以使其中一个比另一个更好。其中最好的一些是 Google 和 Bind,但我认为它们都对您的使用方式有限制(在免费使用场景中,我不知道您愿意做什么)。我不会链接到这些,它们很容易找到。

我看过 OpenRouteService 但我喜欢 MapQuest。可编程网络列出了很多,并且做得很好,跟上了现有的步伐。如果您查看映射类别,您会发现一些服务可能会适合您的需求。

您可能想从不同的提供商那里获取不同的部件。如果你能遵守他们的限制,谷歌是一个很棒的一站式商店。

祝你好运!

MapQuest has a good set of free services and SDKs that are available. They include directions and many other navigation functions.

From what I have seen and tried they are the best out there that place no restrictions on your use in application or on the web.

Check them out here

Update (based on Comment):

There are several out there and it depends on what you are trying to do that will make one better than the other. Some of the best ones are Google and Bind, but I think they both have restrictions on how you use them (in a free usage scenario and I don't know what you are willing to do). I will not link to those, they are easy enough to find.

I have looked at OpenRouteService but I like MapQuest. Programmable web has many listed and do a pretty good job keeping up with what is out there. If you look in the mapping category you will find several services that will probably fit your needs.

You might want to pull different parts from different providers. Google is a great one stop shop if you can stay within their restrictions.

Good luck!

孤单情人 2024-12-28 20:22:18

Mapbox 有适用于 Android 的 SKD: https://www.mapbox.com/blog/mapbox-android /

这也是 Mapbox on Titanium 项目 https://github.com/adampax/titanium-mapbox 其中,在撰写本文时,它仍在维护并不断增长。

另一个选择是 Skobbler/Telenav,它也有 Android SDK:

http://developer.skobbler.com/features #mobileDevicesAndWeb

可以从此处下载

我知道他们也有一个 javascript 库,但我不确定这是否有效/它如何与 Titanium 或 PhoneGap 一起工作。 (如果你发现了,请在评论中告诉我:))

Mapbox has an SKD for android: https://www.mapbox.com/blog/mapbox-android/

The is also Mapbox on Titanium project https://github.com/adampax/titanium-mapbox which, at the time of writing this, is maintained and growing.

Another option would be Skobbler/Telenav which also have a Android SDK:

http://developer.skobbler.com/features#mobileDevicesAndWeb

which can be downloaded from here

I know they also have a javascript library, but I'm not sure if that would work/how it would work with Titanium or PhoneGap. (let me know in a comment if you find out :) )

情泪▽动烟 2024-12-28 20:22:18

这是一个非常古老的问题,但它可能会对某人有所帮助。 Mapbox 最近为 Android 引入了一个新的方向库,它提供逐向导航。它是免费的。

使用方向库非常简单。
只需将以下内容添加到您的 build.gradle 即可开始使用它

repositories {
  mavenCentral()
}

dependencies {
    compile ('com.mapbox.mapboxsdk:mapbox-android-directions:1.0.0@aar'){
        transitive=true
    }
}

为了获取两个地理位置点之间的方向,请使用下面的代码

// Downtown LA
Waypoint origin = new Waypoint(-118.24233, 34.05332);

// Santa Monica Pier
Waypoint destination = new Waypoint(-118.49666, 34.01114);

// Build the client object
MapboxDirections client = new MapboxDirections.Builder()
    .setAccessToken(MAPBOX_ACCESS_TOKEN)
    .setOrigin(origin)
    .setDestination(destination)
    .setProfile(DirectionsCriteria.PROFILE_DRIVING)
    .build();

// Execute the request
Response<DirectionsResponse> response = client.execute();

DirectionsRoute route = response.body().getRoutes().get(0);
int distance = route.getDistance() // 26446 (in meters)

为了在 Mapbox 地图上绘制路线,请执行以下操作:

// Convert List<Waypoint> into LatLng[]
List<Waypoint> waypoints = route.getGeometry().getWaypoints();
LatLng[] points = new LatLng[waypoints.size()];
for (int i = 0; i < waypoints.size(); i++) {
    points[i] = new LatLng(
        waypoints.get(i).getLatitude(),
        waypoints.get(i).getLongitude());
}

// Draw Points on MapView
mapView.addPolyline(new PolylineOptions()
    .add(points)
    .color(Color.parseColor("#3887be"))
    .width(5));

请检查这是:

https://www.mapbox.com/blog/android-directions-library /

A very old question, but it might help someone. Mapbox has recently introduced a new directions library for android which provides turn by turn navigation. It is free.

Using the directions library is pretty straightforward.
Just add the following to your build.gradle to start using it

repositories {
  mavenCentral()
}

dependencies {
    compile ('com.mapbox.mapboxsdk:mapbox-android-directions:1.0.0@aar'){
        transitive=true
    }
}

In order to get directions between two geo location points use the code below

// Downtown LA
Waypoint origin = new Waypoint(-118.24233, 34.05332);

// Santa Monica Pier
Waypoint destination = new Waypoint(-118.49666, 34.01114);

// Build the client object
MapboxDirections client = new MapboxDirections.Builder()
    .setAccessToken(MAPBOX_ACCESS_TOKEN)
    .setOrigin(origin)
    .setDestination(destination)
    .setProfile(DirectionsCriteria.PROFILE_DRIVING)
    .build();

// Execute the request
Response<DirectionsResponse> response = client.execute();

DirectionsRoute route = response.body().getRoutes().get(0);
int distance = route.getDistance() // 26446 (in meters)

In order to draw the route on the Mapbox map, do this:

// Convert List<Waypoint> into LatLng[]
List<Waypoint> waypoints = route.getGeometry().getWaypoints();
LatLng[] points = new LatLng[waypoints.size()];
for (int i = 0; i < waypoints.size(); i++) {
    points[i] = new LatLng(
        waypoints.get(i).getLatitude(),
        waypoints.get(i).getLongitude());
}

// Draw Points on MapView
mapView.addPolyline(new PolylineOptions()
    .add(points)
    .color(Color.parseColor("#3887be"))
    .width(5));

Please check this out:

https://www.mapbox.com/blog/android-directions-library/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文