-
Notifications
You must be signed in to change notification settings - Fork 19
Description
When making a POST to and an UPDATE to
/stream-locations
/locations
both resulted in an incorrect value being stored.
ORIGINALLY posted here (Locations):
@msweier has an issue on discourse here:
https://discourse.hecdev.net/t/cwms-vue-location-table-unit-issue/3444
In stream-locations
if you provide 3 with "mi" for the units you get 4.82 back. This value was stored in CMA's stream-location page. It was also stored using CDA. Both resulted in this. It appears when you store something even if you say "ft" or "mi" it results in the database default units of metric or "m" or "km".
EDIT: I do not know how/why but this endpoint in both CDA and what can be input into CMA is working now. If you run the below payload it will return the correct value for units. Location UPDATE is still having issues.
Click to expand Stream-Location (working now)
{
"stream-location-node": {
"id": {
"office-id": "SWT",
"name": "AARK"
},
"stream-node": {
"stream-id": {
"office-id": "SWT",
"name": "Arkansas_R"
},
"station": 3,
"station-units": "mi"
}
}
}
Results in:
{
"stream-location-node": {
"id": {
"office-id": "SWT",
"name": "AARK"
},
"stream-node": {
"stream-id": {
"office-id": "SWT",
"name": "Arkansas_R"
},
"station": 4.82803,
"station-units": "mi"
}
},
"area-units": "mi2",
"stage-units": "ft"
}
/Locations
In a recent CDA workshop (07/14/2025) where we went through the locations endpoint and the same was true for the elevation in the locations PATCH method.
PATCH (issue shows here) I store as 1 *ft*
curl -X 'PATCH' \
'https://wm.swt.ds.usace.army.mil:8243/swt-data/locations/BEAR' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"office-id": "SWT",
"name": "BEAR",
"latitude": 36.1336111,
"longitude": -95.1166667,
"active": true,
"public-name": "Bear Lake of the Ozarks, USA",
"long-name": "BEAR",
"description": "Bear Lake in USA Test 4",
"timezone-name": "US/Central",
"location-kind": "SITE",
"nation": "US",
"state-initial": "OK",
"county-name": "Tulsa",
"nearest-city": "Sand Springs, OK",
"horizontal-datum": "NAD83",
"vertical-datum": "NGVD29",
"elevation": 1,
"elevation-units": "ft"
}'
{
"office-id": "SWT",
"name": "BEAR",
"latitude": 36.1336111,
"longitude": -95.1166667,
"active": true,
"public-name": "Bear Lake of the Ozarks, USA",
"long-name": "BEAR",
"description": "Bear Lake in USA Test 4",
"timezone-name": "US/Central",
"location-kind": "SITE",
"nation": "US",
"state-initial": "OK",
"county-name": "Tulsa",
"nearest-city": "Sand Springs, OK",
"horizontal-datum": "NAD83",
"vertical-datum": "NGVD29",
"elevation": 1,
"elevation-units": "ft"
}
But then I get back *3.28ft*
curl -X 'GET' \
'https://t7/swt-data/locations/BEAR?office=SWT' \
-H 'accept: application/json;version=2'
{
"office-id": "SWT",
"name": "BEAR",
"latitude": 36.1336111,
"longitude": -95.1166667,
"active": true,
"public-name": "Bear Lake of the Ozarks, USA",
"long-name": "BEAR",
"description": "Bear Lake in USA Test 4",
"timezone-name": "US/Central",
"location-kind": "SITE",
"nation": "US",
"state-initial": "OK",
"county-name": "Tulsa",
"nearest-city": "Sand Springs, OK",
"horizontal-datum": "NAD83",
"vertical-datum": "NGVD29",
"elevation": 3.280839895013123,
"bounding-office-id": "SWT",
"elevation-units": "ft"
}
This might be a Database issue but I have not confirmed that yet with @JeremyDKellett for what CMA is using (if the PL/SQL is the same for stream-locations)