'Helper routine for calling PostGIS functions and returning their result.'

def _get_postgis_func(self, func):

    with self.connection.temporary_connection() as cursor:
        cursor.execute(('SELECT    %s()' % func))
        return cursor.fetchone()[0]
