Skip to content

Commit

Permalink
actually fix zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
papajohn committed Feb 19, 2016
1 parent 4691828 commit 41551f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion datascience/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ def _autozoom(self):
# rough approximation, assuming max_zoom is 18
import math
try:
factor = 1 + max(0, 1 - (self._width/1000)**0.5)
lat_diff = bounds['max_lat'] - bounds['min_lat']
lon_diff = bounds['max_lon'] - bounds['min_lon']
area, max_area = lat_diff*lon_diff, 180*360
if area:
factor = 1 + max(0, 1-area**0.5)
zoom = math.log(area/max_area)/-factor
else:
zoom = self._default_zoom
Expand Down

0 comments on commit 41551f9

Please sign in to comment.