erlaube Fehlende latitude/longitude für History
This commit is contained in:
parent
4691e5b79f
commit
f3c5e73df1
@ -19,25 +19,18 @@ class PoStations(UrlReader):
|
||||
|
||||
stations = []
|
||||
for station_json in stations_json:
|
||||
if 'longitude' not in station_json or 'latitude' not in station_json:
|
||||
print("getStations: WARN: Station hat fehlende Koordinaten: %s" % (station_json['longname'],))
|
||||
continue
|
||||
if 'km' not in station_json:
|
||||
print("getStations: WARN: Station hat fehlende km: %s" % (station_json['longname'],))
|
||||
continue
|
||||
|
||||
stations.append(
|
||||
{
|
||||
'geometry': {
|
||||
'longitude': station_json['longitude'],
|
||||
'latitude': station_json['latitude'],
|
||||
'longitude': station_json['longitude'] if 'longitude' in station_json else None,
|
||||
'latitude': station_json['latitude'] if 'latitude' in station_json else None,
|
||||
},
|
||||
'attributes': {
|
||||
'uuid': station_json['uuid'],
|
||||
'number': station_json['number'],
|
||||
'shortname': station_json['shortname'],
|
||||
'longname': station_json['longname'],
|
||||
'km': station_json['km'],
|
||||
'km': station_json['km'] if 'km' in station_json else None,
|
||||
'agency': station_json['agency'],
|
||||
'water': station_json['water']['longname'],
|
||||
},
|
||||
|
||||
@ -33,12 +33,17 @@ class PoQgsStations(PoStations):
|
||||
|
||||
for station in stations:
|
||||
feature = self._getFeatureForStation(station)
|
||||
features.append(feature)
|
||||
if feature is not None:
|
||||
features.append(feature)
|
||||
|
||||
print("getStationsFeatures: %d Features erzeugt" % (len(features),))
|
||||
return features
|
||||
|
||||
def _getFeatureForStation(self, station) -> QgsFeature:
|
||||
def _getFeatureForStation(self, station) -> None | QgsFeature:
|
||||
if station['geometry']['longitude'] is None or station['geometry']['latitude'] is None:
|
||||
print("_getFeatureForStation: WARN: Station hat fehlende Koordinaten: %s" % (station['attributes']['shortname'],))
|
||||
return None
|
||||
|
||||
feature = QgsFeature(self.fields)
|
||||
|
||||
longitude = station['geometry']['longitude']
|
||||
|
||||
Loading…
Reference in New Issue
Block a user