diff --git a/django/contrib/gis/templates/gis/admin/openlayers.js b/django/contrib/gis/templates/gis/admin/openlayers.js
index 4324693..0108a51 100644
a
|
b
|
|
163 | 163 | } |
164 | 164 | } else { |
165 | 165 | {{ module }}.enableDrawing(); |
| 166 | |
| 167 | var zoomLevel = 14; |
| 168 | |
| 169 | // Try W3C Geolocation method (Preferred) |
| 170 | if (navigator.geolocation) { |
| 171 | navigator.geolocation.getCurrentPosition(function(position) { |
| 172 | {{ module }}.map.setCenter(new OpenLayers.LonLat( |
| 173 | position.coords.longitude, position.coords.latitude |
| 174 | ).transform( |
| 175 | new OpenLayers.Projection("EPSG:4326"), |
| 176 | new OpenLayers.Projection("EPSG:900913") |
| 177 | ), zoomLevel); |
| 178 | }, function() { |
| 179 | // Location could not be found (probably denied by user) |
| 180 | }); |
| 181 | } else if (google.gears) { |
| 182 | // Try Google Gears Geolocation |
| 183 | var geo = google.gears.factory.create('beta.geolocation'); |
| 184 | |
| 185 | geo.getCurrentPosition(function(position) { |
| 186 | {{ module }}.map.setCenter(new OpenLayers.LonLat( |
| 187 | position.longitude, position.latitude).transform( |
| 188 | new OpenLayers.Projection("EPSG:4326"), |
| 189 | new OpenLayers.Projection("EPSG:900913") |
| 190 | ), zoomLevel); |
| 191 | }, function() { |
| 192 | // Location could not be found (probably denied by user) |
| 193 | }); |
| 194 | } else { |
| 195 | // Browser doesn't support Geolocation |
| 196 | } |
166 | 197 | } |
167 | 198 | } |