'Return the placeholder for the given geometry field with the given
value.  Depending on the spatial backend, the placeholder may contain a
stored procedure call to the transformation function of the spatial
backend.'

def get_geom_placeholder(self, f, value, compiler):

    def transform_value(value, field):
        return ((value is not None) and (value.srid != field.srid))
    if hasattr(value, 'as_sql'):
        return (('%s(%%s,    %s)' % (self.spatial_function_name('Transform'), f.srid)) if transform_value(value.output_field, f) else '%s')
    if transform_value(value, f):
        return ('%s(%s(%%s,%s),    %s)' % (self.spatial_function_name('Transform'), self.from_text, value.srid, f.srid))
    elif self.connection.features.has_spatialrefsys_table:
        return ('%s(%%s,%s)' % (self.from_text, f.srid))
    else:
        return ('%s(%%s)' % self.from_text)
