'Create the HTML for a Map section
@param layer_name: the name of the Layer
@param map_id: the id of the map
@param filter: True for an S3MapFilter, otherwise optional filter string for the layer'

def _map(self, layer_name, map_id='default_map', filter=None):

    s3 = current.response.s3
    jqrappend = s3.jquery_ready.append
    if ((filter is True) and current.deployment_settings.get_gis_spatialdb()):
        _map = None
        button = A('DRAW    A    MAP    AREA', _class='button', _id='map_filter_button')
        jqrappend(("$('#%s').appendTo($('#map-here'))" % map_id))
        s3.scripts.append(('/%s/static/themes/WACOP/js/map_filter.js' % current.request.application))
        jqrappend(("S3.wacop_mapFilter('%s')" % map_id))
    else:
        button = None
        ltable = current.s3db.gis_layer_feature
        layer = current.db((ltable.name == layer_name)).select(ltable.layer_id, limitby=(0, 1)).first()
        try:
            layer_id = layer.layer_id
        except:
            layer_id = None
        feature_resources = [{'name': current.T(layer_name), 'id': 'search_results', 'layer_id': layer_id, 'filter': filter}]
        _map = current.gis.show_map(id=map_id, height=350, width=425, collapsed=True, callback=("S3.search.s3map('%s')" % map_id), feature_resources=feature_resources)
    jqrappend(("S3.wacop_resizeMap('%s')" % map_id))
    return (_map, button)
