Download map tile for tkintermapview offline database

660 Views Asked by At

Trying to make a Tkinter UI by using tkintermapview framework. I need to implement offline map tile database to my code. Couldn't find a .db file for specific map area to implement to the code as it is said in GitHub implementation in line 12. Here's my code:

import tkinter
import os
from tkintermapview import TkinterMapView

# create tkinter window
root_tk = tkinter.Tk()
root_tk.geometry(f"{1000}x{700}")
root_tk.title("map_view_simple_example.py")

# path for the database to use
script_directory = os.path.dirname(os.path.abspath(__file__))
database_path = os.path.join(script_directory, "offline_tiles_nyc.db")

# create map widget and only use the tiles from the database, not the online server (use_database_only=True)
map_widget = TkinterMapView(root_tk, width=1000, height=700, corner_radius=0, use_database_only=True,
                            max_zoom=17, database_path=database_path)
map_widget.pack(fill="both", expand=True)

map_widget.set_address("nyc")

root_tk.mainloop()

I tried to use Open Street Map but it gives me an .osm file, but it didn't work.

I'm using Python 3.

0

There are 0 best solutions below