I am trying to create a geospatial Python GUI app using PyQT5, Geopandas, OSMnX, and Folium. I am converting the app into an .EXE file using pyinstaller. The app looks something like this:
I am using GTFS data as well as User-Generated Suggestions data containing user start and end coordinates to display all the bus stops closest for the users within a specified buffer distance. I am also displaying the top 10 most recommended routes between the starting the destination bus stops. I am able to display all of these elements (Markers, Circle Ranges, Circle markers, routes) on the folium element in my PyQT5 GUI app. But when I try to add the tooltip attribute which specifies the number of users who use the route into the code, The map is not displaying anything anymore in the GUI app, it remains the same. But at the same time, If I save the HTML of the folium map, it displays all the elements, as shown below:
The code for initializing and displaying the map on the QTWebEngineWidget is
recoMap = folium.Map(location=[25.2048, 55.2708], zoom_start=10) data = io.BytesIO() recoMap.save(data, close_file=False) self.reco_sug.setHtml(data.getvalue().decode())
And the code for adding tooltip and plotting route is given as:
for ind, freq_route in freq_route_list[:10].iterrows(): # try: origin = [freq_route['stop_lat_A'],freq_route['stop_lon_A']]# oakland, san pablo & market destination = [freq_route['stop_lat_B'], freq_route['stop_lon_B']] # berkeley, sacramento & university from_node = ox.distance.nearest_nodes(self.model.Gdrive, origin, origin) to_node = ox.distance.nearest_nodes(self.model.Gdrive, destination, destination) route = ox.distance.shortest_path(self.model.Gdrive, from_node, to_node, weight='length') route_list += route tooltp = 'Start Point: ' + str(freq_route['stop_name_A']) + ' <br>Destination Point: ' + str(freq_route['stop_name_B']) + '<br>Recommended Count: ' + str(freq_route['Count']) # print(ind) print(freq_route['stop_name_A']) print(freq_route['stop_name_B']) print(freq_route['Count']) if ind == 0: reco_map = ox.plot_route_folium(self.model.Gdrive, route, weight=5,tooltip=tooltp) else: reco_map = ox.plot_route_folium(self.model.Gdrive, route, route_map=reco_map, weight=5, tooltip=tooltp)
Can anyone tell me what I am doing wrong and help me find a way to update my folium map in my PyQT app?