Changeset 9092 for src/django_gheat/gheat/management/commands/dataimport.py
- Timestamp:
- Apr 20, 2011, 12:42:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/management/commands/dataimport.py
r9084 r9092 62 62 bssid = wnetwork.find('BSSID') 63 63 if bssid != None: bssid = bssid.text 64 min_sig = wnetwork.find('snr-info/min_signal_dbm') 65 if min_sig != None: min_sig = int(min_sig.text) 66 else: min_sig = (-99) 67 max_sig = wnetwork.find('snr-info/max_signal_dbm') 68 if max_sig != None: max_sig = int(max_sig.text) 69 else: max_sig= (-99) 64 70 lat = wnetwork.find('gps-info/min-lat') 65 71 if lat != None: lat = lat.text … … 67 73 if lon != None: lon = lon.text 68 74 if ssid is None: continue 69 print enc, ssid, bssid, lat, lon 75 76 avg_sig = (min_sig+max_sig)/2 77 sig = (1.67*avg_sig)+166.67 78 if sig > 100: sig = 100 79 if sig < 0: sig = 0 80 81 print enc, ssid, bssid, lat, lon, sig 70 82 71 83 ap, created = Accespoint.objects.get_or_create(mac=bssid, ssid=ssid, encryptie=enc) 72 m = Meting.objects.create(meetrondje=mr, accespoint=ap, latitude=lat, longitude=lon, signaal= 100)84 m = Meting.objects.create(meetrondje=mr, accespoint=ap, latitude=lat, longitude=lon, signaal=sig) 73 85 74 86
Note:
See TracChangeset
for help on using the changeset viewer.