public class GeoUtils extends Object
| Constructor and Description |
|---|
GeoUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
convertPointsTo2DRanges(com.couchbase.client.java.json.JsonArray startRange,
com.couchbase.client.java.json.JsonArray endRange,
boolean isBoundingBox,
Point... points)
Convert a sequence of
Points describing a polygon to a pair of JsonArray ranges corresponding
to that polygon's bounding box, and inject the coordinates into startRange and endRange. |
static void |
convertShapeTo2DRanges(com.couchbase.client.java.json.JsonArray startRange,
com.couchbase.client.java.json.JsonArray endRange,
Shape shape)
Convert a
Shape to a pair of JsonArray ranges, injected into startRange and endRange. |
static double[] |
getBoundingBoxForNear(Point origin,
Distance distance)
Computes the bounding box approximation for a "near" query (max distance from a point of origin).
|
public static double[] getBoundingBoxForNear(Point origin, Distance distance)
origin - the point of origin, center for the query.distance - the max distance to search within (negative distances will be multiplied by -1).NullPointerException - if any of the origin and distance are nullpublic static void convertPointsTo2DRanges(com.couchbase.client.java.json.JsonArray startRange,
com.couchbase.client.java.json.JsonArray endRange,
boolean isBoundingBox,
Point... points)
Points describing a polygon to a pair of JsonArray ranges corresponding
to that polygon's bounding box, and inject the coordinates into startRange and endRange. If it is already
equivalent to a Box (upper-left Point + lower-right Point), set isBoundingBox to true. Otherwise, this
method will attempt to find the bounding box by finding the lowest and highest X and Y coordinates.startRange - the startRange to populate with this shape's data.endRange - the endRange to populate with this shape's data.isBoundingBox - true to skip finding min/max X and Y coordinates and use 2 Points as a Box.points - the sequence of Points.IllegalArgumentException - if no points are provided, or in the case of isBoundingBox true if more or less
than 2 points are provided or the 2 points are not ordered (a.x <= b.x && a.y <= b.y).public static void convertShapeTo2DRanges(com.couchbase.client.java.json.JsonArray startRange,
com.couchbase.client.java.json.JsonArray endRange,
Shape shape)
Shape to a pair of JsonArray ranges, injected into startRange and endRange.startRange - the startRange to populate with this shape's data.endRange - the endRange to populate with this shape's data.shape - the shape to extract ranges from.IllegalArgumentException - if the Shape is unsupported.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.