Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geo: geo_shape MultiPolygon parsing problem #7126

Closed
spinscale opened this issue Aug 1, 2014 · 2 comments · Fixed by #7190
Closed

Geo: geo_shape MultiPolygon parsing problem #7126

spinscale opened this issue Aug 1, 2014 · 2 comments · Fixed by #7190

Comments

@spinscale
Copy link
Contributor

Trying to index this shape results in an IndexOutOfBoundsException

DELETE /countries
PUT /countries
PUT /countries/location/_mapping
{
  "location" : {
    "properties" : {
      "location" : {
        "type" : "geo_shape"
      }
    }
  }
}


PUT countries/location/somewhere-in-sweden
{ "location" : { 
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [22.183173, 65.723741],
        [21.213517, 65.026005],
        [21.369631, 64.413588],        
        [22.183173, 65.723741]
      ],
      [
        [17.061767, 57.385783],
        [17.210083, 57.326521],
        [16.430053, 56.179196],        
        [17.061767, 57.385783]
      ]
    ]
  ]
} } 

The shape looks valid here https://gist.github.com/spinscale/0c014b3a0f15f90b5c4c

@colings86 colings86 self-assigned this Aug 1, 2014
@colings86 colings86 removed the adoptme label Aug 1, 2014
@colings86
Copy link
Contributor

The GeoJSON in the index request appears to be invalid as it is specifying a single polygon with a hole outside its bounds. The correct request, following the geoJSON spec should be:

PUT countries/location/somewhere-in-sweden
{ "location" : { 
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [22.183173, 65.723741],
        [21.213517, 65.026005],
        [21.369631, 64.413588],        
        [22.183173, 65.723741]
      ]
    ],
    [
      [
        [17.061767, 57.385783],
        [17.210083, 57.326521],
        [16.430053, 56.179196],        
        [17.061767, 57.385783]
      ]
    ]
  ]
} } 

@clintongormley
Copy link

Could we at least throw a nicer error?

colings86 added a commit that referenced this issue Aug 12, 2014
@colings86 colings86 changed the title Geo shape MultiPolygon parsing problem Geo: geo_shape MultiPolygon parsing problem Aug 12, 2014
colings86 added a commit that referenced this issue Sep 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants