You can use EmbeddedSQLExpression in an EntityFunction to use PostGIS functionality in a query.
The main problem is that we don't natively support transforming the output into GeoPosition or Polygon, you'd have to map transformation functions manually on columns. The transformation function is probably hidden away somewhere in the GIS` context...