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

MBTilesMapSource crashes #40

Open
jussikiova opened this issue Oct 4, 2020 · 3 comments
Open

MBTilesMapSource crashes #40

jussikiova opened this issue Oct 4, 2020 · 3 comments

Comments

@jussikiova
Copy link

I'm trying to bring an mbtiles-map to MapView. When trying to run the code MBTilesMapSource crashed with following error

[...]
File "/home/jussi/Työpöytä/Jennin_homma/jennijenni.py", line 8, in build
map_source = MBTilesMapSource("map.mbtiles")
File "/home/jussi/.local/lib/python3.8/site-packages/kivy_garden/mapview/mbtsource.py", line 47, in init
cx = (bounds[2] + bounds[0]) / 2.0
TypeError: 'map' object is not subscriptable

I checked the lines in question:

    if "bounds" in metadata:
        self.bounds = bounds = map(float, metadata["bounds"].split(","))
    if "center" in metadata:
        cx, cy, cz = map(float, metadata["center"].split(","))
    elif self.bounds:
        cx = (bounds[2] + bounds[0]) / 2.0
        cy = (bounds[3] + bounds[1]) / 2.0
        cz = self.min_zoom

It is obvious that in elif-branch of the if-statement, a map-object is referenced by an index, which leads to the crash. I got my application working by turning the map-object to a list-object.

    if "bounds" in metadata:
        self.bounds = bounds = map(float, metadata["bounds"].split(","))
    if "center" in metadata:
        cx, cy, cz = map(float, metadata["center"].split(","))
    elif self.bounds:
        self.bounds = bounds = list(bounds)                      #ADDED
        cx = (bounds[2] + bounds[0]) / 2.0
        cy = (bounds[3] + bounds[1]) / 2.0

To Reproduce
Try to run the MBTilesMapSource with following .mbtiles file

https://drive.google.com/file/d/1rdPAwFW-bx943vQEFGIazMoHE7Pgwtic/view?usp=sharing

Platform
System: Kernel: 5.4.0-48-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.6.7
wm: muffin dm: LightDM Distro: Linux Mint 20 Ulyana base: Ubuntu 20.04 focal

Python 3.8.2

MapView 1.0.5

Kivy 2.0.0rc3

Best regards,

  • Jussi
@jussikiova
Copy link
Author

Now I'm having trouble with this project on Buildozer. The same bug persist there and I've got no idea where it gets its code. Not locally, I presume?

@ibobalo
Copy link

ibobalo commented Sep 26, 2022

this bug was fixed long time ago, but fix was rejected by authors, have no idea why.

a84a17b

@paapu88
Copy link

paapu88 commented Mar 22, 2024

Well, I get the same issue after 4 years... Is this package maintained anymore?
OOps: correction: looking at the source it seems to have been corrected, so I have my own problems here...

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

3 participants