public class Geoshape extends Object
getType() to determine the type of shape of a particular Geoshape object.
Use the static constructor methods to create the desired geoshape.| Modifier and Type | Class and Description |
|---|---|
static class |
Geoshape.GeoshapeBinarySerializer
Geoshape binary serializer using spatial4j's
JtsBinaryCodec. |
static class |
Geoshape.GeoShapeGryoSerializer
Geoshape serializer for TinkerPop's Gryo.
|
static class |
Geoshape.GeoshapeGsonDeserializer
Geoshape JSON deserializer supporting reading from GeoJSON (http://geojson.org/).
|
static class |
Geoshape.GeoshapeGsonSerializer
Geoshape serializer supports writing GeoJSON (http://geojson.org/).
|
static class |
Geoshape.GeoshapeSerializer
Geoshape attribute serializer for Titan.
|
static class |
Geoshape.Point
A single point representation.
|
static class |
Geoshape.Type
The Type of a shape: a point, box, circle, line or polygon.
|
| Modifier and Type | Field and Description |
|---|---|
static com.spatial4j.core.context.jts.JtsSpatialContext |
CTX |
| Modifier and Type | Method and Description |
|---|---|
static Geoshape |
box(double southWestLatitude,
double southWestLongitude,
double northEastLatitude,
double northEastLongitude)
Constructs a new box shape which is identified by its south-west and north-east corner points
|
static Geoshape |
circle(double latitude,
double longitude,
double radiusInKM)
Constructs a circle from a given center point and a radius in kilometer
|
boolean |
contains(Geoshape outer)
Whether this geometry contains the given geometry.
|
boolean |
disjoint(Geoshape other)
Whether this geometry has no points in common with the given geometry.
|
boolean |
equals(Object other) |
static Geoshape |
fromWkt(String wkt)
Create Geoshape from WKT representation.
|
static Geoshape |
geoshape(com.vividsolutions.jts.geom.Geometry geometry)
Constructs a Geoshape from a JTS
Geometry. |
static Geoshape |
geoshape(com.spatial4j.core.shape.Shape shape)
Constructs a Geoshape from a spatial4j
Shape. |
Geoshape.Point |
getPoint()
Returns the singleton point of this shape.
|
Geoshape.Point |
getPoint(int position)
Returns the point at the given position.
|
double |
getRadius()
Returns the radius in kilometers of this circle.
|
com.spatial4j.core.shape.Shape |
getShape()
Returns the underlying
Shape. |
Geoshape.Type |
getType()
Returns the
Geoshape.Type of this geoshape. |
int |
hashCode() |
boolean |
intersect(Geoshape other)
Whether this geometry has any points in common with the given geometry.
|
static boolean |
isValidCoordinate(double latitude,
double longitude)
Whether the given coordinates mark a point on earth.
|
static Geoshape |
line(double... coordinates)
Constructs a new line shape which is identified by its coordinates
|
static Geoshape |
line(List<double[]> coordinates)
Constructs a line from list of coordinates
|
static Geoshape |
point(double latitude,
double longitude)
Constructs a point from its latitude and longitude information
|
static Geoshape |
polygon(double... coordinates)
Constructs a new polygon shape which is identified by its coordinates
|
static Geoshape |
polygon(List<double[]> coordinates)
Constructs a polygon from list of coordinates
|
int |
size()
Returns the number of points comprising this geoshape.
|
String |
toGeoJson()
Returns the GeoJSON representation of the shape.
|
String |
toString()
Returns the WKT representation of the shape.
|
boolean |
within(Geoshape outer)
Whether this geometry is within the given geometry.
|
public String toString()
public String toGeoJson()
public com.spatial4j.core.shape.Shape getShape()
Shape.public Geoshape.Type getType()
Geoshape.Type of this geoshape.public int size()
public Geoshape.Point getPoint(int position)
size().position - public Geoshape.Point getPoint()
public double getRadius()
public boolean intersect(Geoshape other)
other - public boolean within(Geoshape outer)
outer - public boolean contains(Geoshape outer)
outer - public boolean disjoint(Geoshape other)
other - public static final Geoshape point(double latitude, double longitude)
latitude - longitude - public static final Geoshape circle(double latitude, double longitude, double radiusInKM)
latitude - longitude - radiusInKM - public static final Geoshape box(double southWestLatitude, double southWestLongitude, double northEastLatitude, double northEastLongitude)
southWestLatitude - southWestLongitude - northEastLatitude - northEastLongitude - public static final Geoshape line(double... coordinates)
coordinates - Sequence of coordinates (lat1,lon1,...,latN,lonN)public static final Geoshape line(List<double[]> coordinates)
coordinates - Coordinate (lon,lat) pairspublic static final Geoshape polygon(double... coordinates)
coordinates - Sequence of coordinates (lat1,lon1,...,latN,lonN)public static final Geoshape polygon(List<double[]> coordinates)
coordinates - Coordinate (lon,lat) pairspublic static final Geoshape geoshape(com.vividsolutions.jts.geom.Geometry geometry)
Geometry.geometry - public static final Geoshape geoshape(com.spatial4j.core.shape.Shape shape)
Shape.shape - public static final Geoshape fromWkt(String wkt) throws ParseException
wkt - ParseExceptionpublic static final boolean isValidCoordinate(double latitude,
double longitude)
latitude - longitude - Copyright © 2012–2016. All rights reserved.