Hi!
I'm trying to make a quickcapture project in which upon capturing a point, a field of the point is populated depending on the spatial location. The way I thought of doing this is like a SpatialJoin, i.e. intersecting the polygon layer which contains the different areas with the point I just took and retrieving the value of that polygon.
For this I used some code in Arcade I found in this post, example 4. It worked fine but the thing is my field of work is forestry, which means a lot of field work with no reception whatsoever.
That isnt a problem to the code itself but I want to see an offline map while working and the only way I found of doing this is via mobile map package as a map in the quickcapture project. As far as I have tried, I cant use that code while a mmpk is the map of the project, it only works with a web map (which I cant use offline in quickcapture).
I kept thinking a workaround and I tried to use $datastore instead of $map, having the point layer and the polygon layer in the same feature layer so I can use a mmpk as a map. But, the following error popped and I cant find a solution: Cannot read properties of undefined (reading 'find')
So I ask you, is there a way to use an offline map while making an spatial join of the point captured and the polygon the point is taken in? I could use a solution to the aforementioned error or an entire different way to do it.
Thanks!
This is the working code for a web map:
// Create a feature set using the 'prueba_int' layer in the map
var regions = FeatureSetByName($map, "prueba_int", ["SupA"]);
// Intersect the current location with the regions and
// get the first region
var region = First(Intersects($feature, regions));
// If the current location does intersect a feature,
// return the name of the region. Otherwise, return null
if (!IsEmpty(region)) {
return region["SupA"];
} else {
return null;
}