ArtesiaWater / UGW

Python scripts voor oppervlaktewater-component Utrechts GrondWater model (UGW)
4 stars 0 forks source link

Koppeling met online gegevensbronnen #2

Open valdemetriades opened 2 years ago

valdemetriades commented 2 years ago
dbrakenhoff commented 2 years ago

When running 01_merge_sources.py I'm getting the following response for WSRL which results in a KeyError when attempting to access 'maxRecordCount':

{'error': {'code': 500, 'message': 'Service Kaarten/Vigerend_Peilgebieden/MapServer not found ', 'details': []}}

The url is 'https://kaarten.wsrl.nl/arcgis/rest/services/Kaarten/Vigerend_Peilgebieden/MapServer'

dbrakenhoff commented 2 years ago

The new url should be: https://kaarten.wsrl.nl/arcgis/rest/services/Kaarten/Peilgebieden_vigerend/MapServer Also streefpeil attribute is now called STREEFPEIL

dbrakenhoff commented 2 years ago

I'm was able to run the 01_merge_sources.py script, but I'm missing the water_lines.shp file after completion. The logger also indicates some errors reading a V&V source:

WARNING:root:source for RWS not specified in water_lines
INFO:root:water_lines V&V
WARNING:root:reading ESRI-json format (GeoJSON is preferred)
ERROR:root:Processing data from the following url failed: https://services1.arcgis.com/ug8NBKcLHVNmdmdt/ArcGIS/rest/services/Legger_Watersysteem/FeatureServer/15/?f=pjson
ERROR:root:ArcREST Layer has no Unique ID Field, script defaulted to None.Please specify a correct object_id for this layer & adminstration

UPDATE: The 15 ID is not listed in the featureserver documentation. The relevant layers should be 16, 17, 18 now I think, but I'll leave that up to @d2hydro :) .

d2hydro commented 2 years ago

Compared to the original delivery, I changed the following in the sources.json:

V&V had attributes in their legger defining water cross-sections. In their newest service that is gone. As a result, the input-files for MODFLOW will be of less quality. Especially lacking bottom level info is a miss.

JJansen-rhdhv commented 2 years ago

Seems to work now for the whole UGW extent. For a smaller extent there is an issue with at least one of the online sources.

Error messages:

INFO:root:water_lines HDSR ERROR:root:Processing data from the following url failed: https://services1.arcgis.com/1lWKHMyUIR3eKHKD/ArcGIS/rest/services/HydroObjecten/FeatureServer/0/query?where=OBJECTID>=0&geometry=142466.1116914851,466994.8487679956,143122.50046358033,467591.157388806&geometryType=esriGeometryEnvelope&f=json&inSR=28992&returnIdsOnly=true with error local variable 'gdf' referenced before assignment Traceback (most recent call last): File "01_merge_sources.py", line 412, in gdf, gdf_invalid = get_layer(src_layer, admins_gdf) File "01_merge_sources.py", line 258, in get_layer layer, poly, object_filter=object_filter, object_id=object_id) File "D:\UGW_GitHubDesktop\UGW\scripts\oppervlaktewater\services.py", line 190, in get_features raise e File "D:\UGW_GitHubDesktop\UGW\scripts\oppervlaktewater\services.py", line 173, in get_features if not gdf.empty: UnboundLocalError: local variable 'gdf' referenced before assignment

dbrakenhoff commented 2 years ago

@JJansen-rhdhv could you send us the extent? That way we can reproduce the issue locally.

JJansen-rhdhv commented 2 years ago

I think it was this extent (see attached shapefile) Extent_small.zip .

d2hydro commented 2 years ago

I reproduced it and fixed it with a new services.py. @JJansen-rhdhv; can you test if it works?