Repository navigation
Fix Encoder[GeometryCollection] - #3288
Merged
pomadchin merged 2 commits intoSep 4, 2020
Merged
Conversation
agrian-joel
force-pushed
the
geometryCollectionEncoder
branch
from
September 4, 2020 20:53
41a178d to
95ad474
Compare
pomadchin
self-requested a review
September 4, 2020 20:57
Member
|
Hi @agrian-joel thanks a lot for your first contribution! I'll review it a bit later. |
pomadchin
reviewed
Sep 4, 2020
pomadchin
left a comment
Member
There was a problem hiding this comment.
In general LGTM! But I left a minor question in comments.
Thanks again!
Comment on lines
+180
to
+188
| obj.geometries.map({ | ||
| case geom: Point => geom.asJson | ||
| case geom: LineString => geom.asJson | ||
| case geom: Polygon => geom.asJson | ||
| case geom: MultiPolygon => geom.asJson | ||
| case geom: MultiPoint => geom.asJson | ||
| case geom: MultiLineString => geom.asJson | ||
| case geom: GeometryCollection => geom.asJson | ||
| case geom => throw new Exception(s"Unknown Geometry type ${geom.getClass.getName}: $geom") | ||
| }).asJson |
Member
There was a problem hiding this comment.
Hm, I don't think it would make a lot of sense to throw here, the all types supported are listed here.
How about the following?
obj.geometries.collect {
case geom: Point => geom.asJson
case geom: LineString => geom.asJson
case geom: Polygon => geom.asJson
case geom: MultiPolygon => geom.asJson
case geom: MultiPoint => geom.asJson
case geom: MultiLineString => geom.asJson
case geom: GeometryCollection => geom.asJson
}.asJson
agrian-joel
force-pushed
the
geometryCollectionEncoder
branch
from
September 4, 2020 21:24
95ad474 to
5d0d210
Compare
pomadchin
reviewed
Sep 4, 2020
| obj.getAll[GeometryCollection].map(_.asJson) | ||
| ).flatten.asJson | ||
| "geometries" -> | ||
| obj.geometries.map({ |
Member
There was a problem hiding this comment.
In order not to throw in case of the type mismatch, it is possible to use the collect function instead of map here (see #3288 (comment))
…eString should serialize those geometries once. Fixes locationtech#3167 Current behavior encodes them in geometries as both `type: MultX` and `type: GeometryCollection` Signed-off-by: Joel Anna <[email protected]>
agrian-joel
force-pushed
the
geometryCollectionEncoder
branch
from
September 4, 2020 21:31
5d0d210 to
5aff455
Compare
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Encoding a GeometryCollection with a Multipolygon/MultiPoint/MultiLineString should serialize those geometries once
Current behavior encodes them in geometries as both
type: MultiXandtype: GeometryCollectionChecklist
Closes #3167