'Google-Maps Android: Issues drawing complex GeoJson polygons

I have a webservice that returns GeoJson polygons (timezones) and I'm trying to draw them in a layer over the map object using GeoJsonLayer

I already tested the GeoJson file in geojson.io and it looks fine (image at the bottom) but when I add it to the map its not being filled and some extra lines appear down south, it looks like its not closing the poly properly, this is the code I'm using to load the file (I have it locally in raw folder at the moment)

    val layer = GeoJsonLayer(mGoogleMap, R.raw.sample_timezones_response, requireContext())
    layer.addLayerToMap()

    val polygonStyle = GeoJsonPolygonStyle()
    polygonStyle.fillColor = resources.getColor(R.color.color_main_green_200, null)
    polygonStyle.zIndex = 10000f
    layer.features.forEach { it1 ->
        it1.polygonStyle = polygonStyle
    }

This is the json file I'm trying with.

EDIT: the original json file was not followinf the right-hand rule, I fixed it with python lib: geojson-rewind, this is the fixed version that passes the test in https://geojsonlint.com/

I tried also updating to the latest version of the library (18.0.2) and updating the renderer to the newer one but it displays in the same way.

This is how it looks on android: android screenshot with defects

android screenshot with defects 2

This is how its supose to look, same json file in geojson.io: displaying propertly on geojson.io



Solution 1:[1]

When validating the geojson, I get the error:

Line 1: Polygons and MultiPolygons should follow the right-hand rule

https://www.rfc-editor.org/rfc/rfc7946#section-3.1.6

A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jpoehnelt