tcassou / mapsplotlib

Custom Python plots on a Google Maps background. A flexible matplotlib like interface to generate many types of plots on top of Google Maps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set upper limit in `get_zoom` function.

rudolfbyker opened this issue · comments

If the list of latitudes and longitudes passed to get_zoom has only one point, or they are all at the same point, the return value of this function goes to infinity, causing OverflowError: cannot convert float infinity to integer. This should be caught or prevented, and a maximum zoom value returned. OR: A more descriptive error should be raised.

Basically you can just do

if amplitudes.max() == 0:
  return MAX_ZOOM

Hi @rudolfbyker, I'll incorporate these changes, thanks a lot for reporting again!

@rudolfbyker in the end I used a default zoom instead of the maximum, as I find the map friendlier (you can still understand what you're looking at).
Thanks!