Class GeometryParser

java.lang.Object
org.elasticsearch.common.geo.GeometryParser

public final class GeometryParser extends Object
An utility class with to read geometries from a XContentParser or generic object.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GeometryParser(boolean rightOrientation, boolean coerce, boolean ignoreZValue)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.elasticsearch.geometry.Geometry
    parse(org.elasticsearch.xcontent.XContentParser parser)
    Parses supplied XContent into Geometry
    org.elasticsearch.geometry.Geometry
    Parses the value as a Geometry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GeometryParser

      public GeometryParser(boolean rightOrientation, boolean coerce, boolean ignoreZValue)
  • Method Details

    • parse

      public org.elasticsearch.geometry.Geometry parse(org.elasticsearch.xcontent.XContentParser parser) throws IOException, ParseException
      Parses supplied XContent into Geometry
      Throws:
      IOException
      ParseException
    • parseGeometry

      public org.elasticsearch.geometry.Geometry parseGeometry(Object value) throws ElasticsearchParseException
      Parses the value as a Geometry. The following types of values are supported:

      Object: has to contain either lat and lon or geohash fields

      String: expected to be in "latitude, longitude" format, a geohash or WKT

      Array: two or more elements, the first element is longitude, the second is latitude, the rest is ignored if ignoreZValue is true

      Json structure: valid geojson definition

      Throws:
      ElasticsearchParseException