Tasos Stamadianos
01/24/2019, 12:18 AMPostGIS
support, and I'd like to call a PostGIS
function during an insert, but I really can't figure out how to do this. I've seen examples involving ExpressionWithColumnType
, but nothing that actually uses this function during an insert
in a transaction
. Some relevant code:
abstract class SQLFunction<T>(override val columnType: IColumnType) : ExpressionWithColumnType<T>()
class ST_Centroid(private val poly: MultiPolygon): SQLFunction<Point>(PointColumnType()) {
override fun toSQL(queryBuilder: QueryBuilder) = "ST_Centroid($poly)"
}
I'm trying to do this now:
[DbFields.center] = ST_Centroid(boundaryPoly)
where boundaryPoly
is a PostGIS multipolygon.
Any help would be greatly appreciated 🙂tapac
01/24/2019, 9:51 AMFooTable.insert{
it.update(FooTable.point, ST_Centroid(polygon))
}
Tasos Stamadianos
01/27/2019, 12:55 AM