Skip to content

Commit

Permalink
MQL docGeoWithin: Implicitly convert string into geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
murermader committed Dec 25, 2024
1 parent ab5018e commit 72dbe0e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions core/src/main/java/org/polypheny/db/functions/MqlFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,18 @@ public static PolyBoolean docGeoIntersects( PolyValue input, PolyValue geometry
@SuppressWarnings("UnusedDeclaration")
public static PolyBoolean docGeoWithin( PolyValue input, PolyValue geometry, PolyValue distance ) {
try {
// TODO: Do PolyString -> PolyGeometry conversion here
PolyGeometry geometryFilter = geometry.asGeometry();
PolyGeometry geometryFilter;
if (geometry.isString()){
geometryFilter = PolyGeometry.of(geometry.asString().getValue());
if (geometryFilter == null){
throw new GenericRuntimeException( "Cannot parse geometry string %s to type Geometry", distance);
}
} else if (geometry.isGeometry()){
geometryFilter = geometry.asGeometry();
}
else {
throw new GenericRuntimeException( "Cannot parse geometry %s to type Geometry", distance);
}
PolyGeometry inputGeometry = convertInputToPolyGeometry( input, geometryFilter.getSRID() );
double distanceValue;
if (distance.isBigDecimal()){
Expand Down

0 comments on commit 72dbe0e

Please sign in to comment.