1
votes

The documentations says that Cosmos supports Multipolygons but when I want to query using it I don't get the expected result. If I change the multipolygon to a polygon the query works as expected.

This is the result of ST_ISVALIDDETAILED with the multipolygon

Invalid position. A position must be represented by an array of numbers. There must be at least two elements in the array.

This is proof that the multipolygon is not working. Has anyone been able to work with multipolygons?

Note: I have used the multipolygon as example in the documentation. I have created the spatial index for the property.

{ "path": "/Region/Area/?", "types": [ "Point", "LineString", "Polygon", "MultiPolygon" ] }

1
can you share the query and the coordinates you are trying to retrieve? - Mark Brown
I found the issue with the format of the Multipolygon - Juan Pablo Bresciani

1 Answers

3
votes

After investigating more I found that the example on documentation is bad formed. This is the example =>

{
    "type":"MultiPolygon",
    "coordinates":[ [
        [52.0, 12.0],
        [53.0, 12.0],
        [53.0, 13.0],
        [52.0, 13.0],
        [52.0, 12.0]
    ],
    [
        [50.0, 0.0],
        [51.0, 0.0],
        [51.0, 5.0],
        [50.0, 5.0],
        [50.0, 0.0]
    ] ]
}

and is invalid.

This is the right geoJson =>

{
    "type":"MultiPolygon",
    "coordinates":[ [[
        [52.0, 12.0],
        [53.0, 12.0],
        [53.0, 13.0],
        [52.0, 13.0],
        [52.0, 12.0]
    ]],
    [[
        [50.0, 0.0],
        [51.0, 0.0],
        [51.0, 5.0],
        [50.0, 5.0],
        [50.0, 0.0]
    ]]]
}