public class SpatialUtils extends Object
Modifier and Type | Method and Description |
---|---|
static com.spatial4j.core.shape.Shape |
parseGeomSolrException(String geomStr,
com.spatial4j.core.context.SpatialContext ctx)
Parses a 'geom' parameter (might also be used to parse shapes for indexing).
|
static com.spatial4j.core.shape.Point |
parsePoint(String str,
com.spatial4j.core.context.SpatialContext ctx)
Parses either "lat, lon" (spaces optional on either comma side) or "x y" style formats.
|
static com.spatial4j.core.shape.Point |
parsePointSolrException(String externalVal,
com.spatial4j.core.context.SpatialContext ctx)
Calls
parsePoint(String, com.spatial4j.core.context.SpatialContext) and wraps
the exception with SolrException with a helpful message. |
static com.spatial4j.core.shape.Rectangle |
parseRectangeSolrException(String externalVal,
com.spatial4j.core.context.SpatialContext ctx)
Calls
parseRectangle(String, com.spatial4j.core.context.SpatialContext) and wraps the exception with
SolrException with a helpful message. |
static com.spatial4j.core.shape.Rectangle |
parseRectangle(String str,
com.spatial4j.core.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. |
public static com.spatial4j.core.shape.Shape parseGeomSolrException(String geomStr, com.spatial4j.core.context.SpatialContext ctx)
geomStr
can either be WKT or
a rectangle-range syntax (see parseRectangle(String, com.spatial4j.core.context.SpatialContext)
.public static com.spatial4j.core.shape.Point parsePoint(String str, com.spatial4j.core.context.SpatialContext ctx) throws com.spatial4j.core.exception.InvalidShapeException
str
- Non-null; may have leading or trailing spacesctx
- Non-nullcom.spatial4j.core.exception.InvalidShapeException
- If for any reason there was a problem parsing the string or creating the point.public static com.spatial4j.core.shape.Point parsePointSolrException(String externalVal, com.spatial4j.core.context.SpatialContext ctx) throws SolrException
parsePoint(String, com.spatial4j.core.context.SpatialContext)
and wraps
the exception with SolrException
with a helpful message.SolrException
public static com.spatial4j.core.shape.Rectangle parseRectangle(String str, com.spatial4j.core.context.SpatialContext ctx) throws com.spatial4j.core.exception.InvalidShapeException
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, com.spatial4j.core.context.SpatialContext)
.str
- Non-null; may *not* have leading or trailing spacesctx
- Non-nullcom.spatial4j.core.exception.InvalidShapeException
- If for any reason there was a problem parsing the string or creating the rectangle.public static com.spatial4j.core.shape.Rectangle parseRectangeSolrException(String externalVal, com.spatial4j.core.context.SpatialContext ctx) throws SolrException
parseRectangle(String, com.spatial4j.core.context.SpatialContext)
and wraps the exception with
SolrException
with a helpful message.SolrException
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.