Can not create a document has mutlipolygon having hole

Hi, can anyone help me
I am facing a following.

Summary
Can not create a document has mutlipolygon having hole.
I do not know why responses reason is correct or this is bug?
I have visualize the multipolygon, using geojson.
But , It seems correct polygon.

This is the geometry:

MULTIPOLYGON (((477500.00002257974 1327499.999981646, 475000.00002257974 1327499.999981646, 475000.00002257974 1329999.999981646, 475000.00002257974 1332499.999981646, 475000.00002257974 1334999.999981646, 475000.00002257974 1337499.999981646, 475000.00002257974 1339999.999981646, 475000.00002257974 1342499.999981646, 475000.00002257974 1344999.999981646, 475000.00002257974 1347499.999981646, 475000.00002257974 1349999.999981646, 477500.00002257974 1349999.999981646, 477500.00002257974 1352499.999981646, 480000.00002257974 1352499.999981646, 480000.00002257974 1354999.999981646, 482500.00002257974 1354999.999981646, 485000.00002257974 1354999.999981646, 487500.00002257974 1354999.999981646, 487500.00002257974 1352499.999981646, 490000.00002257974 1352499.999981646, 492500.00002257974 1352499.999981646, 495000.00002257974 1352499.999981646, 495000.00002257974 1354999.999981646, 497500.00002257974 1354999.999981646, 500000.00002257974 1354999.999981646, 500000.00002257974 1357499.999981646, 500000.00002257974 1359999.999981646, 502500.00002257974 1359999.999981646, 502500.00002257974 1362499.999981646, 505000.00002257974 1362499.999981646, 507500.00002257974 1362499.999981646, 510000.0000225798 1362499.999981646, 510000.0000225798 1364999.999981646, 512500.0000225798 1364999.999981646, 515000.0000225798 1364999.999981646, 515000.0000225798 1367499.999981646, 515000.0000225798 1369999.999981646, 517500.0000225798 1369999.999981646, 520000.0000225798 1369999.999981646, 522500.0000225798 1369999.999981646, 525000.0000225798 1369999.999981646, 527500.0000225798 1369999.999981646, 530000.0000225798 1369999.999981646, 530000.0000225798 1372499.999981646, 532500.0000225798 1372499.999981646, 532500.0000225798 1374999.999981646, 535000.0000225798 1374999.999981646, 537500.0000225798 1374999.999981646, 537500.0000225798 1377499.999981646, 540000.0000225798 1377499.999981646, 542500.0000225798 1377499.999981646, 545000.0000225798 1377499.999981646, 545000.0000225798 1379999.999981646, 547500.0000225798 1379999.999981646, 547500.0000225798 1382499.999981646, 550000.0000225798 1382499.999981646, 552500.0000225798 1382499.999981646, 555000.0000225798 1382499.999981646, 555000.0000225798 1379999.999981646, 557500.0000225798 1379999.999981646, 557500.0000225798 1377499.999981646, 557500.0000225798 1374999.999981646, 560000.000022579 1374999.999981646, 560000.000022579 1374999.9999816492, 562500.0000225827 1374999.9999816492, 562500.0000225827 1372499.9999816492, 560000.0000225798 1372499.9999816492, 560000.0000225798 1372499.999981646, 562500.0000225798 1372499.999981646, 562500.0000225798 1369999.999981646, 565000.0000225798 1369999.999981646, 565000.0000225798 1367499.999981646, 565000.0000225798 1367499.9999816418, 567500.0000225827 1367499.9999816418, 567500.0000225827 1364999.9999816492, 565000.0000225798 1364999.9999816492, 565000.0000225798 1364999.999981646, 567500.0000225798 1364999.999981646, 567500.0000225798 1362499.999981646, 567500.0000225798 1359999.999981646, 567500.0000225798 1357499.999981646, 567500.0000225798 1354999.999981646, 567500.0000225798 1352499.999981646, 567500.0000225798 1349999.9999816492, 567500.0000225827 1349999.9999816492, 567500.0000225827 1347499.9999816567, 565000.0000225864 1347499.9999816567, 565000.0000225864 1344999.9999816567, 562500.0000225827 1344999.9999816567, 562500.0000225827 1342499.9999816641, 560000.0000225798 1342499.9999816641, 560000.0000225798 1342499.9999816492, 560000.0000225864 1342499.9999816492, 560000.0000225864 1339999.9999816641, 557500.0000225827 1339999.9999816641, 557500.0000225827 1342499.999981646, 557500.0000225798 1342499.999981646, 557500.0000225798 1339999.999981646, 557500.0000225798 1337499.9999816567, 557500.0000225827 1337499.9999816567, 557500.0000225827 1334999.9999816567, 555000.0000225798 1334999.9999816567, 555000.0000225798 1334999.999981646, 557500.0000225798 1334999.999981646, 557500.0000225798 1332499.999981646, 557500.0000225798 1329999.999981646, 557500.0000225798 1327499.999981646, 555000.0000225798 1327499.999981646, 552500.0000225798 1327499.999981646, 550000.0000225798 1327499.999981646, 547500.0000225798 1327499.999981646, 545000.0000225798 1327499.999981646, 542500.0000225798 1327499.999981646, 540000.0000225798 1327499.999981646, 537500.0000225798 1327499.999981646, 535000.0000225798 1327499.999981646, 532500.0000225798 1327499.999981646, 530000.0000225798 1327499.999981646, 527500.0000225798 1327499.999981646, 525000.0000225798 1327499.999981646, 522500.0000225798 1327499.999981646, 520000.0000225798 1327499.999981646, 517500.0000225798 1327499.999981646, 515000.0000225798 1327499.999981646, 512500.0000225798 1327499.999981646, 510000.0000225798 1327499.999981646, 507500.00002257974 1327499.999981646, 505000.00002257974 1327499.999981646, 502500.00002257974 1327499.999981646, 500000.00002257974 1327499.999981646, 497500.00002257974 1327499.999981646, 495000.00002257974 1327499.999981646, 492500.00002257974 1327499.999981646, 490000.00002257974 1327499.999981646, 487500.00002257974 1327499.999981646, 485000.00002257974 1327499.999981646, 482500.00002257974 1327499.999981646, 480000.00002257974 1327499.999981646, 477500.00002257974 1327499.999981646), (562500.0000225827 1344999.9999816567, 562500.0000225827 1347499.999981646, 562500.0000225798 1347499.999981646, 562500.0000225798 1344999.9999816567, 562500.0000225827 1344999.9999816567)), ((567500.0000225827 1359999.9999816567, 567500.0000225827 1362499.9999816492, 570000.0000225864 1362499.9999816492, 570000.0000225864 1359999.9999816567, 570000.0000225864 1357499.9999816567, 570000.0000225864 1354999.9999816567, 567500.0000225827 1354999.9999816567, 567500.0000225827 1357499.9999816567, 567500.0000225827 1359999.9999816567)), ((570000.0000225864 1352499.9999816641, 567500.0000225827 1352499.9999816641, 567500.0000225827 1354999.9999816492, 570000.0000225864 1354999.9999816492, 570000.0000225864 1352499.9999816641)))

Expected behavior
The document is successfuly created.

Actual behavior
Can not create a document.
The reponse is status 400.

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "failed to parse field [location] of type [geo_shape]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "failed to parse field [location] of type [geo_shape]",
    "caused_by": {
      "type": "invalid_shape_exception",
      "reason": "Invalid shape: Hole is not within polygon"
    }
  },
  "status": 400
}

Can someone help with this

Hi,

Pretty sure the issue is in your coordinates. GeoJSON expects coordinates in Longitude, Latitude. From the spec

  1. Coordinate Reference System

The coordinate reference system for all GeoJSON coordinates is a geographic coordinate reference system, using the World Geodetic System 1984 (WGS 84) [WGS84] datum, with longitude and latitude units of decimal degrees. This is equivalent to the coordinate reference system identified by the Open Geospatial Consortium (OGC) URN urn:ogc:def:crs:OGC::CRS84. An OPTIONAL third-position element SHALL be the height in meters above or below the WGS 84 reference ellipsoid. In the absence of elevation values, applications sensitive to height or depth SHOULD interpret positions as being at local ground or sea level.

And indeed the geo_shape field expects coordinates in WGS84. It is actually a bit hidden in the documentation:(Geoshape field type | Elasticsearch Guide [8.11] | Elastic)

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.