Package com.complexible.stardog.spatial
Interface GeospatialIndexConnection
- All Superinterfaces:
AutoCloseable
All lengths and distances are given in DEGREES. Conversions to other uses of measurement can be
performed using DistanceUnit.
- Since:
- 4.0
- Version:
- 4.0.1
- Author:
- Michael Grove
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the shape to the spatial index.voidAdd the shapes to the spatial index.voidbegin()Start a transactionvoidclear()Clear all the features from the indexvoidclose()Close the connection to the index.voidcommit()Commit the transactioncontain(org.locationtech.spatial4j.shape.Shape shape) Return all features that contain the current shapelongcontainSize(org.locationtech.spatial4j.shape.Shape shape) Return the approximate number of features that contain the given shapedoubledistance(org.locationtech.spatial4j.shape.Point thePoint, org.locationtech.spatial4j.shape.Point theOther) Calculate the distance between the pointsget(long theId) Get the shape from the index that has the given iditerator()Return an iterator over all features in the spatial indexnearby(org.locationtech.spatial4j.shape.Point theLocation, double theRadius) Return all shapes within a radius of a given locationlongnearbySize(org.locationtech.spatial4j.shape.Point theLocation, double theRadius) Return the (approximate) number of shapes within a radius of a given locationvoidprepare()Prepare the transaction for commitvoidRemove the feature from the indexvoidRemove all of the features from the indexvoidrollback()Rollback the current transactionlongsize()Return the number of spatial structures stored within the indexvoidUpdate the data about a shape with the same ID.within(org.locationtech.spatial4j.shape.Shape theBox) Return all the features within the given shapelongwithinSize(org.locationtech.spatial4j.shape.Shape theBox) Return the (approximate) number of features within the given shape
-
Method Details
-
close
Close the connection to the index. Any pending transactions are automatically rolled back when closing the connection. Closing a connection multiple times has no effect.- Specified by:
closein interfaceAutoCloseable- Throws:
GeoException- if there was an error closing the index
-
size
Return the number of spatial structures stored within the index- Returns:
- the size
- Throws:
GeoException- if there was an error while retrieving the size of the index
-
distance
double distance(org.locationtech.spatial4j.shape.Point thePoint, org.locationtech.spatial4j.shape.Point theOther) throws GeoException Calculate the distance between the points- Parameters:
thePoint- the pointtheOther- the other point- Returns:
- the distance in degrees
- Throws:
GeoException- if there was an error while calculating the distance
-
within
CloseableIterator<Feature> within(org.locationtech.spatial4j.shape.Shape theBox) throws GeoException Return all the features within the given shape- Parameters:
theBox- the containing shape- Returns:
- all of the features within the shape
- Throws:
GeoException- if there was an error while retrieving the child features
-
contain
CloseableIterator<Feature> contain(org.locationtech.spatial4j.shape.Shape shape) throws GeoException Return all features that contain the current shape- Parameters:
shape- the contained shape- Returns:
- the indexed features that contain the shape
- Throws:
GeoException- if there was an error querying the index
-
withinSize
Return the (approximate) number of features within the given shape- Parameters:
theBox- the containing shape- Returns:
- the (approximate) number of features
- Throws:
GeoException- if there was an error while retrieving the child features
-
containSize
Return the approximate number of features that contain the given shape- Throws:
GeoException
-
nearby
CloseableIterator<Feature> nearby(org.locationtech.spatial4j.shape.Point theLocation, double theRadius) throws GeoException Return all shapes within a radius of a given location- Parameters:
theLocation- the locationtheRadius- radius around the location in degrees- Returns:
- all shapes near the given location
- Throws:
GeoException
-
nearbySize
long nearbySize(org.locationtech.spatial4j.shape.Point theLocation, double theRadius) throws GeoException Return the (approximate) number of shapes within a radius of a given location- Parameters:
theLocation- the locationtheRadius- radius around the location in degrees- Returns:
- the (approximate) number of shapes
- Throws:
GeoException
-
get
Get the shape from the index that has the given id- Parameters:
theId- the id of the shape to retrieve- Returns:
- the shape, or an absent optional if a shape with the given id does not exist
- Throws:
GeoException- if there is an error getting the shape
-
add
Add the shape to the spatial index. Must be called within a transaction- Parameters:
theShape- the shape to add- Throws:
GeoException- if there was an error while adding the shape to the index
-
add
Add the shapes to the spatial index. Must be called within a transaction.- Parameters:
theShapes- the shapes to add- Throws:
GeoException- if there was an error adding the shapes to the index
-
update
Update the data about a shape with the same ID. Must be called within a transaction- Parameters:
theShape- the shape to add- Throws:
GeoException- if there was an error while adding the shape to the index
-
clear
Clear all the features from the index- Throws:
GeoException- if there was an error clearing the index
-
remove
Remove the feature from the index- Parameters:
theShape- the feature to remove- Throws:
GeoException- if there was an error while removing
-
remove
Remove all of the features from the index- Parameters:
theShape- the features to remove- Throws:
GeoException- if there was an error during removal
-
begin
Start a transaction- Throws:
GeoException- if there was an error while starting the transaction
-
prepare
Prepare the transaction for commit- Throws:
GeoException- if there was an error while preparing
-
commit
Commit the transaction- Throws:
GeoException- if there is an error while committing
-
rollback
Rollback the current transaction- Throws:
GeoException- if there is an error while rolling back
-
iterator
Return an iterator over all features in the spatial index- Returns:
- all features
- Throws:
GeoException
-