Morning,
I was wondering if it is possible to use an arcade expression in a pop-up to generate a British National Grid reference in AGOL?
I have been able to do this in ArcGIS Pro in a project which is projected to the British National Grid, calculating geometry attributes for an xy and then using a some python coding to generate a BNG reference from that.
I can also use arcade expressions to show the lat long of a feature in AGOL and or show a BNG reference from an existing xy field in the hosted feature layer.
So is it possible to do this all in AGOL? Take a feature, get the xy and then generate a BNG reference?
I expect that there would be an issue with AGOL using WGS84 Web Mercator (Auxiliary Sphere).
Thanks,
Andy
As far as I'm aware there's no direct way to convert this to return a grid reference from xy, however, I suppose there's a couple of ways you could muckle together a solution.
One would be to download the grids and have this as part of the map, whether it's shown or not, and then have arcade return the result from the grid with the info taken from xy.
The other would be to create a script pre-populating all the grid parameters so that when xy is generated the return is then calculated entirely in script.
@JonathanMcD, thanks for taking the time to respond. I did look into using an OSGB grid but the download SHP file that was available was only to 1km so wouldn't be accurate enough. I guess to do this myself I'd need to create a custom grid and use that which seems like a bit of a faff when I can effectively get the outcome my colleague is after just post field survey in Pro.
Whilst the grid squares won't give you what you need, they'll at the very least give you the correct grid ID. After than you'd concatenate the Grid ID with the gathered x (easting) and y (northing) coordinates.
In arcade, for the pop-up, you'd take the GRID ID then Geometry.x and Geometry.y to return what you're after.
If I have a moment later today I'll try and put together an example for you and share the map here.
@JonathanMcD , thanks very much for offering to do that, very much appreciated. Would the Geometry.x and Geometry.y be calcuated and be taken from an existing field?