Add support for directions responses with "geojson" geometries
まだ誰も着手していません。
評価
調査の方向性
エントリーポイント DirectionsRoute.fromJson(String json) と、レポートで説明されている MapboxDirections レスポンスモデルから始めます。経路案内のステップのジオメトリがどのようにパースされ、DirectionsRoute がどのようにシリアライズされるかを追跡します。GeoJSON ジオメトリを持つルートを、報告されている例外や空の JSON を発生させずにクライアントで利用できる形でパースおよびシリアライズできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I am working on a project where our users will be sharing the same route and use Mapbox in their client apps for navigation.
Since it is important for us to use the same route, it was decided to generate route on a backend side and clients were suppose to download route in json format, parse it and give route to Mapbox Navigation SDK.
I tried to solve this task in 2 ways.
1. Using REST API
I tried to use your REST API for generating a route and it works well, but when I try to parse JSON using DirectionsRoute.fromJson(String json) method I am getting an exception
Expected a string but was BEGIN_OBJECT at line 1 column 969 path $.legs[0].steps[0].geometry
although JSON itself has a valid format.
2. Using Java SDK
On a backed side I was generating a route, but using Mapbox SDK:
String accessToken =
"accees_token";
Point originPoint = Point.fromLngLat(**, **);
Point destinationPoint = Point.fromLngLat(**, **);
MapboxDirections client = MapboxDirections.builder()
.origin(originPoint)
.destination(destinationPoint)
.overview(DirectionsCriteria.OVERVIEW_FULL)
.profile(DirectionsCriteria.PROFILE_WALKING)
.accessToken(accessToken)
.build();
client.enqueueCall(new Callback<>() {
@Override
public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
DirectionsRoute directionsRoute = response.body().routes().get(0);
Gson gson = new Gson();
String json = gson.toJson(directionsRoute, DirectionsRoute.class);
}
@Override
public void onFailure(Call<DirectionsResponse> call, Throwable throwable) {
System.out.println("Error: " + throwable.getMessage());
}
});
But this time converting DirectionsRoute to json returns {}, although route array is not empty.
I only need to generate route on backend side as json and use that route on client side.
Any of these solutions are suitable for us if they will work properly.
Could you help me resolve any of them?
- 主要言語
- Java
- スター
- 438
- フォーク
- 117
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mapbox/mapbox-java のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mapbox/mapbox-java#1640 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
mapbox/mapbox-java#1635 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
mapbox/mapbox-java#1619 ·
-
Mapbox-java incompatible with gson 2.13.0 and up - call to internal GSON classes that were renamed オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
mapbox/mapbox-java#1614 · コメント 2 件 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
mapbox/mapbox-java#1612 · リアクション 1 件 ·
mapbox/mapbox-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
FasterXML/jackson-databind#6229 ·