Hi Everyone,
I'm trying to construct the geometry as an answer for a geoshape feature using the calculate field, and am running into some difficulties.
Firstly I am performing a pulldata @layer getRecordAt request from an AGOL polygon feature layer:
pulldata("@layer", "getRecordAt", "${polygon_feature}", ${Address_activity_location})
and was then using @json calculation to extract the geometry attribute and populate the geoshape this way
"" + string(pulldata("@json",${geometry_query},"geometry"))
[I've tried multiple iterations of the above calculation with and without the "" + string but have only gotten it working in Survey123 Connect and not via the published survey. I have also increased bind::esri:fieldLength to 50000 to capture all of the coordinates and aim to reduce precision in the query when it's working]
I end up with the polygon geometry as the answer:
"pcode_polygon": {
"rings": [
[
[
80.2224833796995,
7.52764666203902
],
[
80.2227977900489,
7.5276021333672
],
........... etc...
and when used to populate the geoshape in Survey123 Connect, this works and displays the geometry correctly, but it doesn't when published to Survey123 and real records are submitted in the survey. The geometry appears empty.
I've since discovered the appropriate format for constructing geoshape/geotrace is:
Individual vertices that make up the answer to a geotrace or geoshape question are space-separated sets of latitude and longitude values (in decimal degrees) separated by a semicolon.
-37.842156723211474 144.95942945338243; -37.83554486071995 144.9726235713864; -37.85681405373047 144.98240735651922; -37.85954045531896 144.97715349053766
I think I could construct the geometry were I able to perform find/replace style regex against "geometry.rings" , but can only seem to find a way to use regex to apply constraints.
Are there any ways to construct appropriate geometry from the existing geometry data? Or is there some simpler construct / copy geometry operation available to perform this that would be more appropriate?
Thanks!