FeatureCollection.fromJson() should also accept a 'Reader' parameter
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 438
- フォーク
- 117
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Currently a FeatureCollection can not be instantiated from a Reader.
The only function provided requires a String in JSON format as can be seen here.
Such approach is inefficient when reading larger files since the entire file content has to be read and stored in memory before it can be transformed into a FeatureCollection.
If a FeatureCollection could be instantiated from a Reader aswell, only parts of the read file would have to be stored in memory which makes this the more desirable approach in the presented situation.
As the used GSON library already enables the use of a Reader instead of a String, the implementation would be very simple and could look like this:
@Nullable
public static FeatureCollection fromJson(@NonNull Reader reader) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
gson.registerTypeAdapterFactory(GeometryAdapterFactory.create());
return gson.create().fromJson(reader, FeatureCollection.class);
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java と既存の fromJson(String) エントリーポイントを確認してください。示されている Gson アダプター設定を使用して Reader のオーバーロードを追加し、その後、関連するプロジェクトのテストを実行して、既存の String の動作を変更せずに Reader 入力から FeatureCollection が生成されることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- api
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100