Package org.elasticsearch.common.geo
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.Geometryparse(org.elasticsearch.common.xcontent.XContentParser parser)Parses supplied XContent into Geometryorg.elasticsearch.geometry.GeometryparseGeometry(java.lang.Object value)Parses the value as aGeometry.
-
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.ParseExceptionParses supplied XContent into Geometry- Throws:
java.io.IOExceptionjava.text.ParseException
-
geometryFormat
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 providedXContentParser. -
parseGeometry
public org.elasticsearch.geometry.Geometry parseGeometry(java.lang.Object value) throws ElasticsearchParseExceptionParses the value as aGeometry. 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
-