'Builds the map options hash for the OpenLayers template.'

def map_options(self):

    def ol_bounds(extent):
        return ('new    OpenLayers.Bounds(%s)' % str(extent))
    def ol_projection(srid):
        return ('new    OpenLayers.Projection("EPSG:%s")' % srid)
    map_types = [('srid', 'projection', 'srid'), ('display_srid', 'displayProjection', 'srid'), ('units', 'units', str), ('max_resolution', 'maxResolution', float), ('max_extent', 'maxExtent', 'bounds'), ('num_zoom', 'numZoomLevels', int), ('max_zoom', 'maxZoomLevels', int), ('min_zoom', 'minZoomLevel', int)]
    map_options = {}
    for (param_name, js_name, option_type) in map_types:
        if self.params.get(param_name, False):
            if (option_type == 'srid'):
                value = ol_projection(self.params[param_name])
            elif (option_type == 'bounds'):
                value = ol_bounds(self.params[param_name])
            elif (option_type in (float, int)):
                value = self.params[param_name]
            elif (option_type in (str,)):
                value = ('"%s"' % self.params[param_name])
            else:
                raise TypeError
            map_options[js_name] = value
    return map_options
