File tree Expand file tree Collapse file tree 1 file changed +25
-9
lines changed Expand file tree Collapse file tree 1 file changed +25
-9
lines changed Original file line number Diff line number Diff line change
1
+
1
2
import json
2
3
import folium
3
- with open ('vehicles-location.json' ) as myfile :
4
- vehicle_data = [myfile .read ()]
4
+ def main ():
5
+ with open ('vehicles-location.json' ) as myfile :
6
+ vehicle_data = [myfile .read ()]
7
+ print (get_ids_locations (vehicle_data ))
8
+ #for i in vehicle_data:
9
+ # map = folium.Map(vehicle_data.value("001078f6-acfd-42fe-8c9c-84cecbb83630", 'location'))
10
+ #map.save('html')
11
+
5
12
6
- dict (vehicle_data )
7
- map = folium .Map (vehicle_data .value ("001078f6-acfd-42fe-8c9c-84cecbb83630" , 'location' ))
8
- map .save ('html' )
9
- class Vehicle :
10
- def __init__ ():
11
- id =
12
13
13
- def
14
+ def get_ids_locations (list_of_dicts ):
15
+ ids = []
16
+ latitudes = []
17
+ longitudes = []
18
+ for i in list_of_dicts :
19
+ for key , value in list_of_dicts .items ():
20
+ if type (value ) is dict and key == "location" :
21
+ get_ids_locations (value )
22
+ else :
23
+ if key == "lat" :
24
+ latitudes .append (value )
25
+ elif key == "lng" :
26
+ longitudes .append (value )
27
+ elif key == "id" :
28
+ ids .append (value )
29
+ return ids , latitudes , longitudes
You can’t perform that action at this time.
0 commit comments