The shape builder uses the jtsGeometry.validate() to validate a polygon. This could be an issue in some cases where the polygon is represented in WGS84.
Here, the jtsGeometry (spatial4j-0.5) states:
// We use cartesian math. It's a limitation/assumption when working with JTS. When geo=true (i.e. we're using // WGS84 instead of a projected coordinate system), the errors here will be pretty terrible east-west. At // 60 degrees latitude, the circle will work as if it has half the width it should. // Instead, consider converting the circle to a polygon first (not great but better), or projecting both first. // Ideally, use Geo3D.
For some polygons, we get an InvalidShapeException because of self intersection. But if we transform them to a cartesian system, the validation will succeed.
So, elasticsearch will not let you index WGS84 polygons (in some cases) even though they are correct.
Wouldnt it be better to be able to switch off the JTS validation of polygons in such a case? Or to somehow provide the representation (WGS84, EPSG:3576, ...) and then choose the right validator?
I could provide an example polygon, that is valid in EPSG:3576 but invalid when validated as an JTSGeometry.