Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add function for latest measurements #34

Closed
veenstrajelmer opened this issue Mar 1, 2024 · 0 comments · Fixed by #35
Closed

add function for latest measurements #34

veenstrajelmer opened this issue Mar 1, 2024 · 0 comments · Fixed by #35

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Mar 1, 2024

  • ddlpy version: master
  • Python version: 3.11
  • Operating System: Windows

Description

The option to retrieve the latest measurements from the webwaterservices is not exposed in ddlpy.

What I Did

import requests
import pandas as pd

# get laatste waarnemingen
url_ddl = 'https://waterwebservices.rijkswaterstaat.nl/ONLINEWAARNEMINGENSERVICES_DBO/OphalenLaatsteWaarnemingen'
request_ddl = {"AquoPlusWaarnemingMetadataLijst":[{"AquoMetadata":{"Compartiment":{"Code":"OW"},"Eenheid":{"Code":"cm"},
    "Grootheid":{"Code":"WATHTE"},
    "Hoedanigheid":{"Code":"NAP"},
    }}],
    "LocatieLijst":[{"X":518882.333320247,"Y":5760829.11729589,"Code":"EURPFM"
    }]
}
resp = requests.post(url_ddl, json=request_ddl)
if not resp.ok:
    raise Exception('%s for %s: %s'%(resp.reason, resp.url, str(resp.text)))
result = resp.json()
if not result['Succesvol']:
    raise Exception('query not succesful, Foutmelding: %s from %s'%(result['Foutmelding'],url_ddl))
for one in result['WaarnemingenLijst']:
    print(one['AquoMetadata']['Grootheid'])
    print(one['AquoMetadata']['Hoedanigheid'])
    print(one['AquoMetadata']['Groepering'])
    # print(one['MetingenLijst'])
    print(one['MetingenLijst'][0]['Tijdstip'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant