Class GeometryParser

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

public final class GeometryParser
extends java.lang.Object
An utility class with a geometry parser methods supporting different shape representation formats
  • Constructor Summary

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

    Modifier and Type Method Description
    GeometryFormat<org.elasticsearch.geometry.Geometry> geometryFormat​(java.lang.String format)
    Returns a geometry format object that can parse and then serialize the object back to the same format.
    GeometryFormat<org.elasticsearch.geometry.Geometry> geometryFormat​(org.elasticsearch.common.xcontent.XContentParser parser)
    Returns a geometry format object that can parse and then serialize the object back to the same format.
    org.elasticsearch.geometry.Geometry parse​(org.elasticsearch.common.xcontent.XContentParser parser)
    Parses supplied XContent into Geometry
    org.elasticsearch.geometry.Geometry parseGeometry​(java.lang.Object value)
    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.common.xcontent.XContentParser parser) throws java.io.IOException, java.text.ParseException
      Parses supplied XContent into Geometry
      Throws:
      java.io.IOException
      java.text.ParseException
    • geometryFormat

      public GeometryFormat<org.elasticsearch.geometry.Geometry> geometryFormat​(java.lang.String format)
      Returns a geometry format object that can parse and then serialize the object back to the same format.
    • geometryFormat

      public GeometryFormat<org.elasticsearch.geometry.Geometry> geometryFormat​(org.elasticsearch.common.xcontent.XContentParser parser)
      Returns a geometry format object that can parse and then serialize the object back to the same format. This method automatically recognizes the format by examining the provided XContentParser.
    • parseGeometry

      public org.elasticsearch.geometry.Geometry parseGeometry​(java.lang.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