Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to parse Multipolygons #38

Open
SheperoMah opened this issue Apr 5, 2022 · 0 comments
Open

How to parse Multipolygons #38

SheperoMah opened this issue Apr 5, 2022 · 0 comments

Comments

@SheperoMah
Copy link

I have a Feature which I want to parse its geometry as Multipolygon instead of the abstract Geometry[LngLat]. How can I do this?

val feature = Json.parse(
    """
      { "type": "Feature", "properties": { "id": 1.0 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 355480.643799999728799, 5300428.16300000064075 ], [ 355464.32149999961257, 5300178.6305 ], [ 355215.011400000192225, 5300195.241900000721216 ], [ 355480.643799999728799, 5300428.16300000064075 ] ] ] ] } }""")


val json = Json.parse(jsonText)
val data = Json.fromJson[Feature[LngLat]](feature)

// val data = Json.fromJson[Feature[MultiPolygon[LngLat]]](feature) // doesn't work for some reason. I cannot find the needed implicit Reads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant