Commits

Anonymous committed 6cfe0bc

Switch to OSM

Comments (0)

Files changed (1)

rentalerts/apps/apartments/templates/apartments/apartment_detail.html

     #map { height: 500px; width: 760px; }
 </style>
 <script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/jquery.js"></script>
-  <script type="text/javascript"
-      src="http://maps.googleapis.com/maps/api/js?key={{ GOOGLE_API_KEY }}&sensor=false">
-    </script>
+
+  <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
     <script type="text/javascript">
+
       function initialize() {
-        var location = new google.maps.LatLng({{ apartment.latitude }}, {{ apartment.longitude }});
-        var mapOptions = {
-          center: location,
-          zoom: 12,
-          mapTypeId: google.maps.MapTypeId.ROADMAP
-        };
-        var map = new google.maps.Map(document.getElementById("map"), mapOptions);
-        var marker = new google.maps.Marker({
-            position: location
-        });
-        marker.setMap(map);
+        map = new OpenLayers.Map("map");
+        map.addLayer(new OpenLayers.Layer.OSM());
+     
+        var lonLat = new OpenLayers.LonLat( {{ apartment.longitude }}, {{ apartment.latitude }} )
+              .transform(
+                new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
+                map.getProjectionObject() // to Spherical Mercator Projection
+              );
+     
+        var zoom=12;
+     
+        var markers = new OpenLayers.Layer.Markers( "Markers" );
+        map.addLayer(markers);
+     
+        markers.addMarker(new OpenLayers.Marker(lonLat));
+     
+        map.setCenter (lonLat, zoom);
+
       }
         $(document).ready(function(){ initialize(); });