Skip to content

Commit 04af8e4

Browse files
authored
Fix USGS location oriented js (#11)
1 parent 8b9d65b commit 04af8e4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

templates/usgs-location-oriented.j2

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@
1818
"ssn": "http://www.w3.org/ns/ssn/",
1919
"ssn-system": "http://www.w3.org/ns/ssn/systems/"
2020
},
21-
"@id": "{{ data['@id'] }}",
21+
"@id": "https://geoconnex.us/iow/usgs/sta/{{ data['name'] }}",
2222
"@type": [
2323
"hyf:HY_HydrometricFeature",
24-
"hyf:HY_HydroLocation",
25-
{% if data['monitoringLocationType'] %}
26-
"locType:{{ data['monitoringLocationType'] }}"
24+
"hyf:HY_HydroLocation"
25+
{% if data['monitoringLocationType'] %},
26+
{% set locTypes = data['monitoringLocationType'].replace(' ', '').split(',') %}
27+
{% for type_ in locTypes %}
28+
"locType:{{ type_ }}"
29+
{% if not loop.last %},{% endif %}
30+
{% endfor %}
2731
{% endif %}
2832
],
2933

3034

3135
{% if data['monitoringLocationType'] %}
32-
"hyf:HydroLocationType": "{{ data['monitoringLocationType'] }}",
36+
"hyf:HydroLocationType": "{{ locTypes[0] }}",
3337
{% endif %}
3438

3539
{#Was told to not worry about changing this for time being, no way to get this without a geospatial query #}
@@ -169,7 +173,7 @@
169173

170174
{#`sites` is the same as the Thing id but the hyphen is replaced by a colon. if there is no hyphen, then you just pipe in the thing id #}
171175
{# We then need to remove the surrounding '' to make sure the query is properly formatted #}
172-
"contentUrl": "https://waterservices.usgs.gov/nwis/iv/?sites={{data['id'] | replace("-", ":" ) | replace("'", "")}}&parameterCd={{ stream["properties"]["ParameterCode"] }}&format=rdb",
176+
"contentUrl": "https://waterservices.usgs.gov/nwis/iv/?parameterCd={{ stream["properties"]["ParameterCode"] }}&sites={{data['id'] | replace("-", ":" ) | replace("'", "")}}&format=rdb",
173177
"encodingFormat": [
174178
"text/tab-separated-values"
175179
],

0 commit comments

Comments
 (0)