+def _locate_interpolation(table: SaFromClause, wkt: WKTElement) -> SaLabel:
+ """ Given a position, locate the closest point on the line.
+ """
+ return sa.case((table.c.linegeo.ST_GeometryType() == 'ST_LineString',
+ sa.func.ST_LineLocatePoint(table.c.linegeo, wkt)),
+ else_=0).label('position')
+
+