Laden mehrerer Objekte auf einer Google-Karte mit Python

stimmen
0

Wir versuchen, mehrere Objekte auf eine Google-Karte zu drucken, aber Schwierigkeiten haben, die richtigen Funktionen zum Einsatz zu finden, es zu tun. Wir laden eine JSON-Datei eines Python-Skript verwenden und hoffen, einige Vorschläge über zu bekommen, was Python-Plugin hilft dies getan. Wir haben viel versucht, aber noch kein Glück.

def graph_data(json_dictionary, cam_lat, cam_lng, frame, color=red, color2=cornflowerblue, edge_width=2.5):
    for i in range(len(json_dictionary[Frame  + str(frame)])):
        lat_list, lng_list = [], []
        # finds the current angle
        angle = json_dictionary[Frame  + str(frame)][i][angle]
        # finds the current distance
        distance = json_dictionary[Frame  + str(frame)][i][distance]
        # finds the point that needs to be put on the graph
        gps_coordinate = geod.Direct(cam_lat, cam_lng, angle, distance)
        # updates the previous_lat_lng dictionary to be able to be used in the graphing function
        previous_lat_lng = update_dict(json_dictionary, frame, gps_coordinate[lat2], gps_coordinate[lon2])
        # gets the ID of the current selected object to map
        id = json_dictionary[Frame  + str(frame)][i][ID]
        # iterates over the previous_lat_lng dictionary within the current id
        # to append the entire history of latitude and longitude coordinates
        for l in previous_lat_lng[id]:
            lat_list.append(l[0])
            lng_list.append(l[1])
        gmap3 = gmplot.GoogleMapPlotter(cam_lat, cam_lng, 20)
        # plots the line of where the person traveled
        gmap3.plot(lat_list, lng_list, color, edge_width)
        gmap3.marker(gps_coordinate[lat2], gps_coordinate[lon2], color2, title=id)
        # changes the directory to save the map to a separate folder within the project folder
        os.chdir(maps)
        # draws the google map and saves it to the map folder
        gmap3.draw(map + str(frame) +  -  + str(id) + .html)
        # changes the directory back 1 folder to prevent errors
        os.chdir(..)
Veröffentlicht am 19/03/2020 um 22:05
quelle vom benutzer
In anderen Sprachen...                            

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more