Skip to content

OpenSearch rejects complex geometries (multipolygon). OS v2.19 #533

@MathewNWSH

Description

@MathewNWSH

OpenSearch rejects complex geometries that cross the antimeridian or pass near the pole.

I know this is primarily a database limitation, but I thought it would be worth sharing the observation because similar shapes or use cases may appear in other items.

When trying to ingest the following item:

https://pastebin.com/ALJYqsw6
(this is the corresponding cdse stac item: https://browser.stac.dataspace.copernicus.eu/collections/sentinel-3-sr-1-sra-a-stc/items/S3A_SR_1_SRA_A__20251117T153905_20251117T162935_20251119T075435_3029_132_382______PS1_O_ST_005) (it's pgstac)

I encountered the following error:
failed to parse field [geometry] of type [geo_shape]

At first, I suspected that the geometry simplification process might contain errors (near the pole or the date line). However, QGIS reports that the GeoJSON is valid. I also tried forcing a right-hand rule geometry and replacing the original one, but the error remained the same.

I then tried loading the item into pgSTAC — and it worked. I’m aware that OpenSearch is much stricter when ingesting shapes, and that PostGIS is far more advanced in this area, but collections like Sentinel-3 and Sentinel-5 contain complex geometries almost throughout. Because of that, we should either:

  • develop shared documentation describing how such geometries should be processed, or
  • adjust the OpenSearch mapping configuration to allow these geometries to be indexed.

Below is the mapping I used:

..."properties": {
    "assets": {
        "enabled": false,
        "type": "object"
    },
    "bbox": {
        "enabled": false,
        "type": "object"
    },
    "collection": {
        "type": "keyword"
    },
    "geometry": {
        "type": "geo_shape"
    },
    ...
}

I also share the feature in a geojson format (for the ease of geometry revision):

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {"type":"MultiPolygon","coordinates":[[[[171.537,-81.4214],[171.538,-81.4196],[180,-81.31478731324597],[180,-81.3166011682243],[171.537,-81.4214]]],[[[-176.481,-81.2712],[-165.332,-80.7752],[-155.603,-79.9829],[-147.45,-78.9579],[-140.745,-77.7585],[-135.251,-76.4306],[-130.727,-75.0083],[-126.965,-73.5159],[-123.8,-71.9707],[-121.105,-70.385],[-118.783,-68.7677],[-116.76,-67.1255],[-114.98,-65.4632],[-113.397,-63.7846],[-111.979,-62.0923],[-110.697,-60.3887],[-109.529,-58.6755],[-108.46,-56.9541],[-107.473,-55.2255],[-106.558,-53.4907],[-105.705,-51.7505],[-104.905,-50.0053],[-104.152,-48.2558],[-103.441,-46.5024],[-102.766,-44.7455],[-102.123,-42.9853],[-101.509,-41.2222],[-100.92,-39.4564],[-100.354,-37.688],[-99.8086,-35.9174],[-99.2811,-34.1446],[-98.7699,-32.3699],[-98.2734,-30.5932],[-97.7901,-28.8149],[-97.3187,-27.035],[-96.8579,-25.2536],[-96.4067,-23.4708],[-95.9641,-21.6868],[-95.5291,-19.9016],[-95.1009,-18.1153],[-94.6787,-16.328],[-94.2617,-14.5398],[-93.8494,-12.7508],[-93.4411,-10.9611],[-93.036,-9.17075],[-92.6337,-7.37984],[-92.2336,-5.58846],[-91.8352,-3.79669],[-91.4378,-2.00462],[-91.041,-0.212326],[-90.6442,1.58011],[-90.247,3.37259],[-89.8487,5.16505],[-89.449,6.9574],[-89.0471,8.74955],[-88.6425,10.5414],[-88.2348,12.3329],[-87.8232,14.124],[-87.4071,15.9145],[-86.9858,17.7043],[-86.5586,19.4935],[-86.1248,21.2818],[-85.6834,23.0692],[-85.2337,24.8556],[-84.7745,26.6408],[-84.3049,28.4249],[-83.8236,30.2075],[-83.3293,31.9887],[-82.8205,33.7683],[-82.2956,35.5462],[-81.7528,37.3221],[-81.19,39.0959],[-80.6048,40.8675],[-79.9946,42.6366],[-79.3562,44.4029],[-78.6862,46.1662],[-77.9803,47.9262],[-77.2339,49.6825],[-76.4413,51.4347],[-75.5958,53.1822],[-74.6895,54.9245],[-73.713,56.6608],[-72.6548,58.3902],[-71.5011,60.1116],[-70.2346,61.8237],[-68.8342,63.5248],[-67.2732,65.2127],[-65.5181,66.8847],[-63.5259,68.5371],[-61.2411,70.1653],[-58.5914,71.7627],[-55.482,73.3208],[-51.7888,74.8275],[-47.3497,76.266],[-41.9597,77.6128],[-35.3761,78.8346],[-27.3539,79.8862],[-17.7439,80.7097],[-6.66545,81.2406],[5.33046,81.4244],[5.33045,81.4226],[-6.66309,81.2388],[-17.7396,80.708],[-27.3485,79.8846],[-35.3702,78.8332],[-41.9538,77.6115],[-47.3439,76.2649],[-51.7832,74.8264],[-55.4768,73.3198],[-58.5864,71.7618],[-61.2364,70.1644],[-63.5215,68.5364],[-65.514,66.884],[-67.2693,65.212],[-68.8304,63.5242],[-70.231,61.8231],[-71.4977,60.111],[-72.6516,58.3896],[-73.7099,56.6602],[-74.6865,54.924],[-75.5929,53.1817],[-76.4385,51.4342],[-77.2312,49.682],[-77.9778,47.9257],[-78.6837,46.1658],[-79.3538,44.4024],[-79.9922,42.6361],[-80.6026,40.867],[-81.1878,39.0955],[-81.7507,37.3216],[-82.2935,35.5457],[-82.8184,33.7679],[-83.3272,31.9883],[-83.8216,30.2071],[-84.3029,28.4245],[-84.7726,26.6404],[-85.2318,24.8552],[-85.6815,23.0688],[-86.1229,21.2814],[-86.5568,19.4931],[-86.9839,17.7039],[-87.4052,15.9141],[-87.8214,14.1236],[-88.233,12.3325],[-88.6408,10.541],[-89.0453,8.74916],[-89.4472,6.95701],[-89.847,5.16466],[-90.2452,3.3722],[-90.6425,1.57971],[-91.0392,-0.212719],[-91.436,-2.00501],[-91.8334,-3.79709],[-92.2319,-5.58886],[-92.632,-7.38024],[-93.0343,-9.17115],[-93.4393,-10.9615],[-93.8476,-12.7512],[-94.2599,-14.5402],[-94.6768,-16.3284],[-95.099,-18.1157],[-95.5272,-19.902],[-95.9622,-21.6872],[-96.4048,-23.4712],[-96.856,-25.254],[-97.3168,-27.0354],[-97.7881,-28.8153],[-98.2714,-30.5937],[-98.7678,-32.3703],[-99.279,-34.145],[-99.8064,-35.9178],[-100.352,-37.6885],[-100.918,-39.4568],[-101.507,-41.2226],[-102.121,-42.9858],[-102.764,-44.746],[-103.439,-46.5029],[-104.15,-48.2563],[-104.902,-50.0058],[-105.702,-51.751],[-106.555,-53.4913],[-107.47,-55.2261],[-108.457,-56.9547],[-109.526,-58.6761],[-110.693,-60.3893],[-111.975,-62.093],[-113.394,-63.7852],[-114.976,-65.4639],[-116.756,-67.1263],[-118.779,-68.7685],[-121.101,-70.3858],[-123.795,-71.9716],[-126.96,-73.5169],[-130.722,-75.0094],[-135.246,-76.4318],[-140.739,-77.7597],[-147.444,-78.9594],[-155.598,-79.9845],[-165.328,-80.7769],[-176.479,-81.273],[-180,-81.3166011682243],[-180,-81.31478731324597],[-176.481,-81.2712]]]]}
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions