I'm trying to build a survey that will automatically populate the Township, Range, and Section values when the user drops a point. The pulldata returns JSON when querying the main layer, but returns it intermittently with sublayer 1, hardly ever with sublayer 2, and never with sublayer 3, which is the one I need (PLSS Intersected). Example result in screenshot.
I'm new to Survey123 but after watching @IsmaelChivite's tutorial about "GetRecordAt", I tested it with a different layer and it works perfectly. The layer I'm trying to query does have a lot of attributes, that's the only thing I can think that would be different. Query is enabled on both and both are public and accessible. Test layer shown as last record in table.
decimal | DLat | Latitude (DD) | round(pulldata("@geopoint", ${location},"y"), 6) |
decimal | DLon | Longitude (DD) | round(pulldata("@geopoint", ${location},"x"), 6) |
text | PLSS_json | PLSS JSON | pulldata("@layer", "getRecordAt", "https://services2.arcgis.com/FiaPA4ga0iQKduv3/arcgis/rest/services/Public_Land_Survey_System_view/Fe...", ${location}) |
text | GetJSON_TEST | Test JSON | pulldata("@layer", "getRecordAt", "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Administrative_Divisions/Fea...", ${location}) |
Interesting, I'll have to look more into that. I wonder if there's any way to set the scale that Survey123 does the Intersect at.
Is it possible that intersect layer is just too big. I loaded it up for a test since it is a public service and the form loads incredibly slow compared to the state level layer. I tested it manually from the rest api and there is no issues, so I wonder if it is just loading the entire layer and it is bogged down?
Do you need the entire US, would it be feasible to export your area of interest and host it yourself?
I'd prefer to avoid self-hosting if possible. I'm new to Survey123, but I assumed that using pulldata would basically just query the REST API anyway, so you're not really loading all the data into anything, it's just using the coordinates you submit. Is that not an accurate statement?
Forgot but have you tested setting a relevant on the calls to check for the lat/long being filled in first. like string-length(${DLat}) > 0. I am still not sure on the round as the order of operations it runs the calcs comes up again and again. There are tons of posts of pulldata not working properly when it is inside a function. The form does not run calcs from top to bottom. It does things more by the type. So runs defaults, then appearance, then calcs, then pulldata kind of thing. pulldata is just so picky and you are stringing them together by pulling the lat/long. It could be running the PLSS calls before the lat/long is there. And the fact it happens on all of them.
You could also test calculationMode=always on these just to see.