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
BinaryCodec . |
static class |
Geoshape.GeoShapeGryoSerializer
Geoshape serializer for TinkerPop's Gryo.
|
static class |
Geoshape.GeoshapeGsonDeserializerV1d0
Geoshape deserializer for GraphSON 1.0 supporting reading from GeoJSON (http://geojson.org/).
|
static class |
Geoshape.GeoshapeGsonDeserializerV2d0
Geoshape deserializer for GraphSON 2.0 supporting reading from GeoJSON (http://geojson.org/).
|
static class |
Geoshape.GeoshapeGsonSerializerV1d0
Geoshape serializer for GraphSON 1.0 supporting writing GeoJSON (http://geojson.org/).
|
static class |
Geoshape.GeoshapeGsonSerializerV2d0
Geoshape serializer for GraphSON 2.0 supporting writing GeoJSON (http://geojson.org/).
|
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 String |
FIELD_COORDINATES |
static JtsGeoshapeHelper |
HELPER |
static org.apache.tinkerpop.shaded.jackson.databind.ObjectWriter |
mapWriter |
Modifier | Constructor and Description |
---|---|
protected |
Geoshape(org.locationtech.spatial4j.shape.Shape shape) |
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(org.locationtech.spatial4j.shape.Shape shape)
Constructs a Geoshape from a spatial4j
Shape . |
static org.locationtech.spatial4j.shape.ShapeFactory.MultiShapeBuilder<org.locationtech.spatial4j.shape.Shape> |
getGeometryCollectionBuilder() |
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.
|
org.locationtech.spatial4j.shape.Shape |
getShape()
Returns the underlying
Shape . |
static org.locationtech.spatial4j.shape.ShapeFactory |
getShapeFactory() |
static org.locationtech.spatial4j.context.SpatialContext |
getSpatialContext() |
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(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(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.
|
Map<String,Object> |
toMap() |
String |
toString()
Returns the WKT representation of the shape.
|
boolean |
within(Geoshape outer)
Whether this geometry is within the given geometry.
|
public static final String FIELD_COORDINATES
public static final JtsGeoshapeHelper HELPER
public static final org.apache.tinkerpop.shaded.jackson.databind.ObjectWriter mapWriter
public String toString()
public String toGeoJson()
public Map<String,Object> toMap() throws IOException
IOException
public org.locationtech.spatial4j.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 Geoshape point(double latitude, double longitude)
latitude
- longitude
- public static Geoshape circle(double latitude, double longitude, double radiusInKM)
latitude
- longitude
- radiusInKM
- public static Geoshape box(double southWestLatitude, double southWestLongitude, double northEastLatitude, double northEastLongitude)
southWestLatitude
- southWestLongitude
- northEastLatitude
- northEastLongitude
- public static Geoshape line(List<double[]> coordinates)
coordinates
- Coordinate (lon,lat) pairspublic static Geoshape polygon(List<double[]> coordinates)
coordinates
- Coordinate (lon,lat) pairspublic static Geoshape geoshape(org.locationtech.spatial4j.shape.Shape shape)
Shape
.shape
- public static Geoshape fromWkt(String wkt) throws ParseException
wkt
- ParseException
public static boolean isValidCoordinate(double latitude, double longitude)
latitude
- longitude
- public static org.locationtech.spatial4j.context.SpatialContext getSpatialContext()
public static org.locationtech.spatial4j.shape.ShapeFactory getShapeFactory()
public static org.locationtech.spatial4j.shape.ShapeFactory.MultiShapeBuilder<org.locationtech.spatial4j.shape.Shape> getGeometryCollectionBuilder()
Copyright © 2012–2023. All rights reserved.