Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot render Layout with an odd number of maps and defined N_SIZE and M_SIZE values #1701

Open
maptastik opened this issue Oct 27, 2020 · 0 comments

Comments

@maptastik
Copy link

Problem

It is possible to render a layout with an odd number of instances of Map() with the default N_SIZE and M_SIZE values. However, the result is a single row of containing several maps, a layout which may not be ideal in all circumstances. However, when I attempt to render a Layout() instance with a defined N_SIZE and M_SIZE values and an odd number of instances of Map(), the rendering fails.

Version Info

  • Python: 3.6, 3.8
  • cartoframes: 1.0.4
  • OS: Ubuntu 18.04

Code Snippet

See this Colab Notebook for a runnable version

from cartoframes.viz import Layout, Map

# Generate list of 3 instances of Map()
maps_list = [Map() for m in range(3)]

# Add the list of 3 maps to a 2x2 layout
Layout(maps = maps_list, n_size = 2, m_size = 2)

Error message:

---------------------------------------------------------------------------
UndefinedError                            Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/IPython/core/formatters.py in __call__(self, obj)
    336             method = get_real_method(obj, self.print_method)
    337             if method is not None:
--> 338                 return method()
    339             return None
    340         else:

10 frames
/usr/local/lib/python3.6/dist-packages/jinja2/environment.py in getitem(self, obj, argument)
    450         """Get an item or attribute of an object but prefer the item."""
    451         try:
--> 452             return obj[argument]
    453         except (AttributeError, TypeError, LookupError):
    454             if isinstance(argument, string_types):

UndefinedError: list object has no element 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant