sgraaf/papermap

Next one - variable issues in latest version

buttoni2020 opened this issue · 2 comments

Hi,

I was a bit to fast with my previous announcement, that everythings works out.

Using following simplyfied code:

from papermap import PaperMap
#from papermap.gpx import GPX

[script specific variable determination]

#gpx_track = GPX("2020-07-22_Eiger/20200721-142919.gpx")
pm = PaperMap(center_ns, center_ew, tile_server="OpenTopoMap", size="A3", scale=25000) #gpx=gpx_track
pm.render()

when using papermap 0.1.1 --> no issues, I do receive a proper map
when using papermap 0.2 --> issue with print out:

runfile('C:/Users/ryzen-tme/Desktop/Python-Karten/2020-09_Kartenskript.py', wdir='C:/Users/ryzen-tme/Desktop/Python-Karten')
Traceback (most recent call last):

  File "C:[...]\Python-Karten\2020-09_Kartenskript.py", line 94, in <module>
    pm.render()

  File "C:[...]\WPy64-3830\python-3.8.3.amd64\lib\site-packages\papermap\papermap.py", line 381, in render
    self.render_grid()

  File "C:[...]WPy64-3830\python-3.8.3.amd64\lib\site-packages\papermap\papermap.py", line 249, in render_grid
    x_grid_cs_and_labels, y_grid_cs_and_labels = self.compute_grid_coordinates()

  File "C:[...]\WPy64-3830\python-3.8.3.amd64\lib\site-packages\papermap\papermap.py", line 205, in compute_grid_coordinates
    x_rnd = round(x, -3)

UnboundLocalError: local variable 'x' referenced before assignment

seems to be a new code-passage. can not find the equivalent in previous version.

BTW: using winpy64-spyder software to write and running this code on win10 x64 roughly latest version.

This is a bug! I just made some changes and it should be fixed now. If you install a newer version from source, all should be fine.

thank you very much, receiving maps as hoped.