public class Distance extends Geometry
Geo.distance
.
This is a circle in a two-dimensional XY plane represented by its center point and radius. It is used as a search
criteria to determine whether or not another geospatial object lies within a circular area.
Note that this shape has no equivalent in the OGC and GeoJSON standards: as a consequence, asWellKnownText()
returns a custom format, and asWellKnownBinary()
, and asGeoJson()
are not
supported.Constructor and Description |
---|
Distance(Point center,
double radius)
Creates a new distance with the given center and radius.
|
Modifier and Type | Method and Description |
---|---|
String |
asGeoJson()
The distance type has no equivalent in the GeoJSON standard: this method throws an
UnsupportedOperationException . |
ByteBuffer |
asWellKnownBinary()
The distance type has no equivalent in the OGC standard: this method throws an
UnsupportedOperationException . |
String |
asWellKnownText()
Returns a Well-known Text (WKT)
representation of this geospatial type.
|
boolean |
contains(Geometry geometry)
Tests whether this geospatial type instance contains another instance.
|
boolean |
equals(Object o) |
static Distance |
fromWellKnownText(String source)
Creates a distance from its Well-known Text (WKT)
representation.
|
Point |
getCenter() |
double |
getRadius() |
int |
hashCode() |
public Distance(Point center, double radius)
center
- The center point.radius
- The radius of the circle representing distance.public static Distance fromWellKnownText(String source)
source
- the Well-known Text representation to parse.InvalidTypeException
- if the string does not contain a valid Well-known Text representation.asWellKnownText()
public Point getCenter()
public double getRadius()
public String asWellKnownText()
Since there is no Well-known Text specification for Distance, this returns a custom format of:
DISTANCE((center.x center.y) radius)
asWellKnownText
in class Geometry
public ByteBuffer asWellKnownBinary()
UnsupportedOperationException
.asWellKnownBinary
in class Geometry
public String asGeoJson()
UnsupportedOperationException
.Copyright © 2012–2018. All rights reserved.