FeatureCollection.fromJson() should also accept a 'Reader' parameter
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Đọc services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java và entry point fromJson(String) hiện có. Thêm overload cho Reader bằng thiết lập Gson adapter đã nêu, sau đó chạy các bài kiểm thử liên quan của dự án và xác nhận rằng đầu vào Reader tạo ra một FeatureCollection mà không thay đổi hành vi hiện có của String.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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);
}
- Ngôn ngữ chính
- Java
- Star
- 438
- Fork
- 117
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mapbox/mapbox-java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mapbox/mapbox-java#1640 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
mapbox/mapbox-java#1635 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
mapbox/mapbox-java#1619 ·
-
Mapbox-java incompatible with gson 2.13.0 and up - call to internal GSON classes that were renamed Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
mapbox/mapbox-java#1614 · 2 bình luận · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
mapbox/mapbox-java#1612 · 1 reaction ·
Tất cả issue của mapbox/mapbox-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
elastic/gradle-plugins#157 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cryptomator/hub#497 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
johanhaleby/occurrent#1120 ·