'Render this widget as HTML helper object(s)
@param resource: the resource
@param values: the search values from the URL query'

def widget(self, resource, values):

    settings = current.deployment_settings
    if (not settings.get_gis_spatialdb()):
        current.log.warning('No    Spatial    DB    =>    Cannot    do    Intersects    Query    yet    =>    Disabling    S3MapFilter')
        return ''
    attr_get = self.attr.get
    opts_get = self.opts.get
    _class = attr_get('class')
    if _class:
        _class = ('%s    %s' % (_class, self._class))
    else:
        _class = self._class
    _id = attr_get('_id')
    input = INPUT(_type='hidden', _class=_class, _id=_id)
    if (values not in (None, [])):
        if (type(values) is list):
            values = values[0]
        input['_value'] = values
    map_id = ('%s-map' % _id)
    (c, f) = resource.tablename.split('_', 1)
    c = opts_get('controller', c)
    f = opts_get('function', f)
    ltable = current.s3db.gis_layer_feature
    query = (((ltable.controller == c) & (ltable.function == f)) & (ltable.deleted == False))
    layer = current.db(query).select(ltable.layer_id, ltable.name, limitby=(0, 1)).first()
    try:
        layer_id = layer.layer_id
    except:
        layer_id = None
        layer_name = resource.tablename
    else:
        layer_name = layer.name
    feature_resources = [{'name': current.T(layer_name), 'id': 'search_results', 'layer_id': layer_id, 'filter': opts_get('filter')}]
    button = opts_get('button')
    if button:
        toolbar = opts_get('toolbar', False)
    else:
        toolbar = True
    _map = current.gis.show_map(id=map_id, height=opts_get('height', settings.get_gis_map_height()), width=opts_get('width', settings.get_gis_map_width()), collapsed=True, callback=("S3.search.s3map('%s')" % map_id), feature_resources=feature_resources, toolbar=toolbar, add_polygon=True)
    return TAG[''](input, button, _map)
