{% load unlocalize_point %}
<div id="{{map_id}}" style="height:250px;width:250px;"></div>
<script>
    {{map_id}} = new OpenLayers.Map("{{map_id}}");
    {{map_id}}.addLayer(new OpenLayers.Layer.OSM());
    var fromProjection = new OpenLayers.Projection("EPSG:4326");
    var toProjection = new OpenLayers.Projection("EPSG:900913");
    {% ifequal geom_type 'point' %}
    var lat = '{{geom.y|unlocalize_point}}';
    var lon = '{{geom.x|unlocalize_point}}';
    var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection,
                                                             toProjection);

    var {{map_id}}markers = new OpenLayers.Layer.Markers( "Markers" );
    {{map_id}}.addLayer({{map_id}}markers);
    {{map_id}}markers.addMarker(new OpenLayers.Marker(position));
    var zoom = 18;
    {{map_id}}.setCenter(position, zoom);
    {% else %}
    var wkt_reader = new OpenLayers.Format.WKT({
                'internalProjection':toProjection,
                'externalProjection':fromProjection
    });
    var {{map_id}}vectors = new OpenLayers.Layer.Vector("Vector Layer");
    {{map_id}}.addLayer({{map_id}}vectors);
    var {{map_id}}features = wkt_reader.read('{{geom.wkt}}');
    {{map_id}}vectors.addFeatures([{{map_id}}features]);

    {{map_id}}.zoomToExtent({{map_id}}vectors.getDataExtent());
    {% endifequal %}
</script>
