org.apache.solr.util

## Class SpatialUtils

- java.lang.Object
- - org.apache.solr.util.SpatialUtils

-     public class SpatialUtils
      extends Object

  Utility methods pertaining to spatial.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.locationtech.spatial4j.shape.Shape` | `parseGeomSolrException(String geomStr, org.locationtech.spatial4j.context.SpatialContext ctx)` Parses a 'geom' parameter (might also be used to parse shapes for indexing).
    `static org.locationtech.spatial4j.shape.Point` | `parsePoint(String str, org.locationtech.spatial4j.context.SpatialContext ctx)` Parses either "lat, lon" (spaces optional on either comma side) or "x y" style formats.
    `static org.locationtech.spatial4j.shape.Point` | `parsePointSolrException(String externalVal, org.locationtech.spatial4j.context.SpatialContext ctx)` Calls `parsePoint(String, org.locationtech.spatial4j.context.SpatialContext)` and wraps the exception with `SolrException` with a helpful message.
    `static org.locationtech.spatial4j.shape.Rectangle` | `parseRectangeSolrException(String externalVal, org.locationtech.spatial4j.context.SpatialContext ctx)` Calls `parseRectangle(String, org.locationtech.spatial4j.context.SpatialContext)` and wraps the exception with `SolrException` with a helpful message.
    `static org.locationtech.spatial4j.shape.Rectangle` | `parseRectangle(String str, org.locationtech.spatial4j.context.SpatialContext ctx)` Parses `str` in the format of '[minPoint TO maxPoint]' where `minPoint` is the lower left corner and maxPoint is the upper-right corner of the bounding box.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### parseGeomSolrException

          public static org.locationtech.spatial4j.shape.Shape parseGeomSolrException(String geomStr,
                                                                                      org.locationtech.spatial4j.context.SpatialContext ctx)

      Parses a 'geom' parameter (might also be used to parse shapes for indexing). `geomStr` can either be WKT or a rectangle-range syntax (see `parseRectangle(String, org.locationtech.spatial4j.context.SpatialContext)`.

    - #### parsePoint

          public static org.locationtech.spatial4j.shape.Point parsePoint(String str,
                                                                          org.locationtech.spatial4j.context.SpatialContext ctx)
                                                                   throws org.locationtech.spatial4j.exception.InvalidShapeException

      Parses either "lat, lon" (spaces optional on either comma side) or "x y" style formats. Spaces can be basically anywhere. And not any whitespace, just the space char.
      Parameters:
        `str` - Non-null; may have leading or trailing spaces
        `ctx` - Non-null
      Returns:
        Non-null
      Throws:
        `org.locationtech.spatial4j.exception.InvalidShapeException` - If for any reason there was a problem parsing the string or creating the point.

    - #### parsePointSolrException

          public static org.locationtech.spatial4j.shape.Point parsePointSolrException(String externalVal,
                                                                                       org.locationtech.spatial4j.context.SpatialContext ctx)
                                                                                throws SolrException

      Calls `parsePoint(String, org.locationtech.spatial4j.context.SpatialContext)` and wraps the exception with `SolrException` with a helpful message.
      Throws:
        `SolrException`

    - #### parseRectangle

          public static org.locationtech.spatial4j.shape.Rectangle parseRectangle(String str,
                                                                                  org.locationtech.spatial4j.context.SpatialContext ctx)
                                                                           throws org.locationtech.spatial4j.exception.InvalidShapeException

      Parses `str` in the format of '[minPoint TO maxPoint]' where `minPoint` is the lower left corner and maxPoint is the upper-right corner of the bounding box. Both corners may optionally be wrapped with a quote and then it's parsed via `parsePoint(String, org.locationtech.spatial4j.context.SpatialContext)`.
      Parameters:
        `str` - Non-null; may *not* have leading or trailing spaces
        `ctx` - Non-null
      Returns:
        the Rectangle
      Throws:
        `org.locationtech.spatial4j.exception.InvalidShapeException` - If for any reason there was a problem parsing the string or creating the rectangle.

    - #### parseRectangeSolrException

          public static org.locationtech.spatial4j.shape.Rectangle parseRectangeSolrException(String externalVal,
                                                                                              org.locationtech.spatial4j.context.SpatialContext ctx)
                                                                                       throws SolrException

      Calls `parseRectangle(String, org.locationtech.spatial4j.context.SpatialContext)` and wraps the exception with `SolrException` with a helpful message.
      Throws:
        `SolrException`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.