diff options
| author | Justin Bronn <jbronn@gmail.com> | 2009-04-26 06:01:59 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2009-04-26 06:01:59 +0000 |
| commit | 1269f9a3e96ed4d0913ba97b9bcc37427f560e84 (patch) | |
| tree | 36543f1ab1628face3cbc4b672d0b6ceb84e325e | |
| parent | 66db0b43ad8759c1d95669847ac8153c36f2ac48 (diff) | |
Fixed #9299 -- Made default zoom level for points in the admin more sensible. Thanks to oyvind for ticket and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10635 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/gis/admin/options.py | 3 | ||||
| -rw-r--r-- | django/contrib/gis/templates/gis/admin/openlayers.js | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/django/contrib/gis/admin/options.py b/django/contrib/gis/admin/options.py index d729b88a5a..6a63a9fe78 100644 --- a/django/contrib/gis/admin/options.py +++ b/django/contrib/gis/admin/options.py @@ -33,6 +33,7 @@ class GeoModelAdmin(ModelAdmin): map_srid = 4326 map_template = 'gis/admin/openlayers.html' openlayers_url = 'http://openlayers.org/api/2.7/OpenLayers.js' + point_zoom = num_zoom - 6 wms_url = 'http://labs.metacarta.com/wms/vmap0' wms_layer = 'basic' wms_name = 'OpenLayers WMS' @@ -100,6 +101,7 @@ class GeoModelAdmin(ModelAdmin): 'scale_text' : self.scale_text, 'map_width' : self.map_width, 'map_height' : self.map_height, + 'point_zoom' : self.point_zoom, 'srid' : self.map_srid, 'display_srid' : self.display_srid, 'wms_url' : self.wms_url, @@ -124,4 +126,5 @@ if gdal.HAS_GDAL: map_srid = 900913 max_extent = '-20037508,-20037508,20037508,20037508' max_resolution = 156543.0339 + point_zoom = num_zoom - 6 units = 'm' diff --git a/django/contrib/gis/templates/gis/admin/openlayers.js b/django/contrib/gis/templates/gis/admin/openlayers.js index 17aed153b3..93286cc464 100644 --- a/django/contrib/gis/templates/gis/admin/openlayers.js +++ b/django/contrib/gis/templates/gis/admin/openlayers.js @@ -127,6 +127,9 @@ } // Zooming to the bounds. {{ module }}.map.zoomToExtent(admin_geom.geometry.getBounds()); + if ({{ module }}.is_point){ + {{ module }}.map.zoomTo({{ point_zoom }}); + } } else { {{ module }}.map.setCenter(new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }}), {{ default_zoom }}); } |
