Cosmos db unexpected validation failures from GeoJSON obtained from UK Environment Agency

混江龙づ霸主 提交于 2020-04-17 21:14:27

问题


UPDATE 2020-03-04

Using MySql Server 8.0.19 I am able to successfully validate this GeoJSON using SELECT ST_IsValid(ST_GeomFromGeoJSON(geojson)) FROM test; The data type for geojson column is json.

ORIGINAL QUESTION

I'm new to the geospatial game, and it appears very much non-trivial! The headlines suggest Cosmos db supports GeoJSON out of the box with the exception that ST_WITHIN() doesn't support holes. Not a problem.

So I loaded up all the of the available "polygons" from https://environment.data.gov.uk/flood-monitoring/doc/reference into Cosmos db

What I find is that 2,417 out of 3,851 are reported as invalid by Cosmos, yet when I grab several of the alleged invalid ones they render just fine on http://geojson.io Also I note every single MulitPolygon fails validation too, no rendering problem again. There are 1,947 of those.

The source for the below single example is: https://environment.data.gov.uk/flood-monitoring/id/floodAreas/055WAF137PB/polygon

SELECT ST_ISVALIDDETAILED(c.features[0].geometry) FROM c WHERE c.id = "055WAF137PB"
[
    {
        "$1": {
            "valid": false,
            "reason": "Not valid because an invalid polygon or multi-polygon is detected."
        }
    }
]

For completeness here is a one that does pass validation in Cosmos https://environment.data.gov.uk/flood-monitoring/id/floodAreas/011WAFGB/polygon

And a MultiPolygon (which fails) https://environment.data.gov.uk/flood-monitoring/id/floodAreas/053FWFPUWI06/polygon

Many thanks in anticipation for your Expert opinions and suggestions.

来源:https://stackoverflow.com/questions/60517677/cosmos-db-unexpected-validation-failures-from-geojson-obtained-from-uk-environme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!