Package org.teiid.query.function
Class GeometryUtils
- java.lang.Object
-
- org.teiid.query.function.GeometryUtils
-
public class GeometryUtils extends Object
Utility methods for geometry TODO: determine if we should use buffermanager to minimize memory footprint
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeometryUtils.Extent
static class
GeometryUtils.Ordinate
-
Field Summary
Fields Modifier and Type Field Description static org.locationtech.jts.geom.GeometryFactory
GEOMETRY_FACTORY
-
Constructor Summary
Constructors Constructor Description GeometryUtils()
-
Method Summary
-
-
-
Method Detail
-
geometryToClob
public static ClobType geometryToClob(AbstractGeospatialType geometry, boolean withSrid) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryFromClob
public static GeometryType geometryFromClob(ClobType wkt) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryFromClob
public static org.locationtech.jts.geom.Geometry geometryFromClob(ClobType wkt, Integer srid, boolean allowEwkt) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryToGml
public static ClobType geometryToGml(CommandContext ctx, GeometryType geometry, boolean withGmlPrefix) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryFromGml
public static GeometryType geometryFromGml(ClobType gml, Integer srid) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryFromGml
public static org.locationtech.jts.geom.Geometry geometryFromGml(Reader reader, Integer srid) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryFromBlob
public static GeometryType geometryFromBlob(BlobType wkb) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryFromBlob
public static GeometryType geometryFromBlob(BlobType wkb, int srid) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
intersects
public static Boolean intersects(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
contains
public static Boolean contains(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
disjoint
public static Boolean disjoint(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
crosses
public static Boolean crosses(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
distance
public static Double distance(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
touches
public static Boolean touches(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
overlaps
public static Boolean overlaps(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
getGeometryType
public static GeometryType getGeometryType(org.locationtech.jts.geom.Geometry jtsGeom)
-
getGeometryType
public static GeometryType getGeometryType(org.locationtech.jts.geom.Geometry jtsGeom, int srid)
-
getGeographyType
public static GeographyType getGeographyType(org.locationtech.jts.geom.Geometry geom, CommandContext ctx) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
getGeographyType
public static GeographyType getGeographyType(org.locationtech.jts.geom.Geometry geom)
-
getBytes
public static byte[] getBytes(org.locationtech.jts.geom.Geometry jtsGeom, boolean bigEndian)
-
getGeometry
public static org.locationtech.jts.geom.Geometry getGeometry(AbstractGeospatialType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
getGeometry
public static org.locationtech.jts.geom.Geometry getGeometry(InputStream is1, Integer srid, boolean allowEwkb) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
equals
public static Boolean equals(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryFromEwkb
public static GeometryType geometryFromEwkb(InputStream is, Integer srid) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geographyFromEwkb
public static GeographyType geographyFromEwkb(CommandContext ctx, InputStream is) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
simplify
public static GeometryType simplify(GeometryType geom, double tolerance) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
simplifyPreserveTopology
public static GeometryType simplifyPreserveTopology(GeometryType geom, double tolerance) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
boundingBoxIntersects
public static boolean boundingBoxIntersects(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
envelope
public static GeometryType envelope(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
within
public static Boolean within(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
dwithin
public static Boolean dwithin(GeometryType geom1, GeometryType geom2, double distance) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryToEwkb
public static BlobType geometryToEwkb(AbstractGeospatialType geometry)
We'll take the wkb format and add the extended flag/srid- Parameters:
geometry
-- Returns:
-
area
public static double area(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
boundary
public static GeometryType boundary(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
buffer
public static GeometryType buffer(GeometryType geom, double distance) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
buffer
public static GeometryType buffer(GeometryType geom, double distance, int quadrantSegments) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
centroid
public static GeometryType centroid(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
convexHull
public static GeometryType convexHull(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
coordDim
public static Integer coordDim(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
difference
public static GeometryType difference(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
intersection
public static GeometryType intersection(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
dimension
public static int dimension(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
startEndPoint
public static GeometryType startEndPoint(GeometryType geom, boolean start) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
exteriorRing
public static GeometryType exteriorRing(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryN
public static GeometryType geometryN(GeometryType geom, int index) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
geometryType
public static String geometryType(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
isClosed
public static Boolean isClosed(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
isEmpty
public static Boolean isEmpty(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
isRing
public static Boolean isRing(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
isSimple
public static Boolean isSimple(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
isValid
public static Boolean isValid(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
length
public static Double length(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
numInteriorRings
public static Integer numInteriorRings(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
numGeometries
public static int numGeometries(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
numPoints
public static int numPoints(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
interiorRingN
public static GeometryType interiorRingN(GeometryType geom, int i) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
orderingEquals
public static Boolean orderingEquals(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
point
public static GeometryType point(double x, double y)
-
pointN
public static GeometryType pointN(GeometryType geom, int i) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
perimeter
public static Double perimeter(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
pointOnSurface
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
polygon
public static GeometryType polygon(GeometryType geom, int srid) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
relate
public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
relate
public static String relate(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
symDifference
public static GeometryType symDifference(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
union
public static GeometryType union(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
ordinate
public static Double ordinate(GeometryType geom, GeometryUtils.Ordinate ordinate) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
makeEnvelope
public static GeometryType makeEnvelope(double xmin, double ymin, double xmax, double ymax, Integer srid)
-
snapToGrid
public static GeometryType snapToGrid(GeometryType geom, double size) throws FunctionExecutionException
- Throws:
FunctionExecutionException
-
-