Class GeographyValidator

java.lang.Object
org.elasticsearch.geometry.utils.GeographyValidator
All Implemented Interfaces:
GeometryValidator

public class GeographyValidator extends Object implements GeometryValidator
Validator that checks that lats are between -90 and +90 and lons are between -180 and +180 and altitude is present only if ignoreZValue is set to true. It also validates a rectangle/envelope's y-ordinates (maxY cannot be less than minY), but deliberately does not validate x-ordinate ordering: unlike CartesianValidator, a geographic envelope may legitimately have minX greater than maxX, to represent one that crosses the antimeridian.
  • Constructor Details

    • GeographyValidator

      protected GeographyValidator(boolean ignoreZValue)
  • Method Details

    • instance

      public static GeometryValidator instance(boolean ignoreZValue)
    • checkLatitude

      protected void checkLatitude(double latitude)
      validates latitude value is within standard +/-90 coordinate bounds
    • checkLongitude

      protected void checkLongitude(double longitude)
      validates longitude value is within standard +/-180 coordinate bounds
    • checkAltitude

      protected void checkAltitude(double zValue)
    • validateCoordinate

      public void validateCoordinate(double x, double y, double z)
      Description copied from interface: GeometryValidator
      Validates a single coordinate and throws IllegalArgumentException if it is not valid. Default implementation is a no-op.
      Specified by:
      validateCoordinate in interface GeometryValidator
    • validate

      public void validate(Geometry geometry)
      Description copied from interface: GeometryValidator
      Validates the geometry and throws IllegalArgumentException if the geometry is not valid
      Specified by:
      validate in interface GeometryValidator