Folium mapping in wrong position

Viewed 62

I'm trying to create a program where data is pulled from an SQL db and then put out into the map. It maps only some points, and when it does they are in Africa which is not where the coordinates were set in the db file.

import folium
import sqlite3

fga = folium.FeatureGroup(name="POI")
#Maps
map = folium.Map(location=[43.733777671205, -79.37156631524043], 
           zoom_start=11)

try:
    sqliteConnection = sqlite3.connect('cord.db')
    cursor = sqliteConnection.cursor()
    print("Connected to SQLite")

    sqlite_select_query = """SELECT longitude, latitude FROM cord;"""
        
    cursor.execute(sqlite_select_query)
        
    items = cursor.fetchall()
        
    for item in items:
        fga.add_child(folium.Marker(location = item[0]))
            
    cursor.close()

finally:
    if (sqliteConnection):
        sqliteConnection.close()
        print("The SQLite connection is closed")

map.add_child(fga)
map.add_child(folium.LayerControl())

map.save("CORD.html")
0 Answers
Related