ZGIS / smart-owc-geojson

Owc Context GeoJSON Encoding for Play
Apache License 2.0
1 stars 1 forks source link

make optional RectangleGeometryFormat for readNullable[Rectangle] #8

Open allixender opened 7 years ago

allixender commented 7 years ago

If a read of (JsPath \ "geometry").readNullable[Rectangle](new RectangleGeometryFormat) fails, then the supposed Option[Rectangle] is not returned, but the complete read for OwcResource can fail.

The OwcResource must still be valid, even the Geometry Read fails, becaue the Spec says it's optional 0..1.

Example of too small Rectangle/Polygon (actually a point)

"geometry": {
            "type": "Polygon",
            "coordinates": [
                [
                    [175.351028, -41.016694],
                    [175.351028, -41.016694],
                    [175.351028, -41.016694],
                    [175.351028, -41.016694],
                    [175.351028, -41.016694]
                ]
            ]
        }

fails with:

JsError ValidationError error.expected.rectangle, Too few distinct points in geometry component at or near point (175.351028, -41.016694, NaN)