From 61de4a8f3bb297ae1489c3cbd13332b2fe6d9f63 Mon Sep 17 00:00:00 2001 From: Travis Rivers <trivers@contractor.usgs.gov> Date: Tue, 10 Nov 2020 11:13:05 -0700 Subject: [PATCH] fix elements --- geomagio/api/ws/Observatory.py | 2 +- geomagio/api/ws/elements.py | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/geomagio/api/ws/Observatory.py b/geomagio/api/ws/Observatory.py index 93cbd08f1..34c5021d1 100644 --- a/geomagio/api/ws/Observatory.py +++ b/geomagio/api/ws/Observatory.py @@ -171,7 +171,7 @@ OBSERVATORIES = [ declination_base=209690, ), Observatory( - id="FRT", + id="FDT", elevation=69, latitude=38.205, longitude=282.627, diff --git a/geomagio/api/ws/elements.py b/geomagio/api/ws/elements.py index 11a6c95d7..a1379ad77 100644 --- a/geomagio/api/ws/elements.py +++ b/geomagio/api/ws/elements.py @@ -10,15 +10,18 @@ router = APIRouter() @router.get("/elements/") def get_elements() -> Dict: - return { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "id": e.id, - "properties": {"name": e.name, "units": e.units}, - "geometry": None, - } - for e in ELEMENTS - ], - } + features = [] + for e in ELEMENTS: + feature = { + "type": "Feature", + "id": e.id, + "properties": { + "name": e.name, + "units": e.units, + }, + "geometry": None, + } + if e.abbreviation: + feature["properties"]["abbreviation"] = e.abbreviation + features.append(feature) + return {"type": "FeatureCollection", "features": features} -- GitLab