Moin, ich wollte Open-sky- Daten in Qgis visualisieren. Dazu habe ich versucht,
den Ablauf von
https://www.geodose.com/2020/09/realtime%20live%20data%20visualization%20qgis.html
nachzustellen. Nun muss ich dazu sagen, dass ich von Python keine Ahnung habe
und das auch nur eine ergebnisoffene Spielerei ist. Ich habe mir folgenden Code
von der oben genannten Seite kopiert, eine *. Csv- Datei erstellt und in Zeile
16 den Pfad zu der Csv- Datei in das Script eingefügt:
#'''
#LIVE AIR DATA TRAFFIC REQUEST
#by ideagora geomatics | www.geodose.com<http://www.geodose.com> | @ideageo
#'''
#IMPORTING LIBRARIES
import requests
import json
import csv
import time
#AREA EXTENT COORDINATE GCS WGS84
lon_min,lat_min=-125.974,30.038
lon_max,lat_max=-68.748,52.214
#CSV OUPUT PATH
csv_data='C:\Users\nschn\Documents\geodaten\Qgis\Flightdata\data.csv'
#REST API QUERY
user_name=''
password=''
url_data='https://'+user_name+':'+password+'@opensky-network.org/api/states/all?'+'lamin='+str(lat_min)+'&lomin='+str(lon_min)+'&lamax='+str(lat_max)+'&lomax='+str(lon_max)
col_name=['icao24','callsign','origin_country','time_position','last_contact','long','lat','baro_altitude','on_ground','velocity',
'true_track','vertical_rate','sensors','geo_altitude','squawk','spi','position_source']
#REQUEST INTERVAL
if user_name !='' and password !='':
sleep_time=5
else:
sleep_time=10
#GET DATA AND STORE INTO CSV
while col_name !='':
with open(csv_data,'w') as csv_file:
csv_writer=csv.writer(csv_file,delimiter=',',quotechar='"',quoting=csv.QUOTE_ALL)
csv_writer.writerow(col_name)
response=requests.get(url_data).json()
try:
n_response=len(response['states'])
except Exception:
pass
else:
for i in range(n_response):
info=response['states'][i]
csv_writer.writerow(info)
time.sleep(sleep_time)
print('Get',len(response['states']),'data')
Anschließend habe ich das Script mit der Python- Konsole geöffnet. Es
erscheinen mehrere Fehlermeldungen, die mir nichts sagen.
2021-09-13T16:42:51 WARNING Traceback (most recent call last):
File
"C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\console\console.py", line 653,
in runScriptEditor
self.tabEditorWidget.currentWidget().newEditor.runScriptCode()
File
"C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\console\console_editor.py", line
451, in runScriptCode
if self.syntaxCheck():
File
"C:/Users/nschn/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\bettereditor\customclasses.py",
line 49, in syntaxCheck
return check_syntax(self, filename, fromContextMenu)
File
"C:/Users/nschn/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\bettereditor\indicatorsutils.py",
line 33, in check_syntax
if eline not in editor.bufferMarkerLine:
AttributeError: 'Editor' object has no attribute 'bufferMarkerLine'
Kann mir eventuell jemand sagen, was ich falsch mache?
Ich arbeite mit Windows 10, 64 bit und QGIS 3.16.7
Nils Schneekloth
Ohldörp 81 - 24783 Osterrönfeld
Fon: +49 4331 6646278
Mobil: 0151 20332942
Email: [email protected]<mailto:[email protected]>
_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user