Skip to content

Commit

Permalink
Fixed #9299 -- Made default zoom level for points in the admin more s…
Browse files Browse the repository at this point in the history
…ensible. Thanks to oyvind for ticket and initial patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10635 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jbronn committed Apr 26, 2009
1 parent 66db0b4 commit 1269f9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions django/contrib/gis/admin/options.py
Expand Up @@ -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'
Expand Down Expand Up @@ -100,6 +101,7 @@ class OLMap(self.widget):
'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,
Expand All @@ -124,4 +126,5 @@ class OSMGeoAdmin(GeoModelAdmin):
map_srid = 900913
max_extent = '-20037508,-20037508,20037508,20037508'
max_resolution = 156543.0339
point_zoom = num_zoom - 6
units = 'm'
3 changes: 3 additions & 0 deletions django/contrib/gis/templates/gis/admin/openlayers.js
Expand Up @@ -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 }});
}
Expand Down

0 comments on commit 1269f9a

Please sign in to comment.