Hello everybody,
I am in the process of building a web map in Experience Builder and I would to let the users open a new Google Maps tab with the same map extent and possibly zoom level.
I reckon the best way to do this is via a custom widget. However, as this is not currently possible on my side, I thought that having an URL in the pop-up of the selected feature can get the job done in a similar way.
As such, I went to the map in Map Viewer (the newest version) and inserted the following Arcade expression in the pop-up settings of my layer:
var centroid = Centroid(Geometry($feature))
var x = centroid.x
var y = centroid.y
//MISSING CODES: Convert from EPSG:27700 to EPSG:4326 to correctly display the map in Google Maps
var URL = "https://www.google.com/maps/@" + x + "," + y + ",4000m"
This is a very simple code. However, as my map is in EPSG:27700 (British National Grid), I would need to convert the x and y values into EPSG:4326, which is the projection system used in Google Maps. Since Arcade does not support reprojection natively, I would need to find another way to achieve the wanted result.
I had a look online and found a more complex expression in this post: Create URL link to Google Street View for arcgis o... - Esri Community, which apparently worked for some users. However, when I tried to run it on my end, Arcade didn't recognise some of its functions.
How would it be possible to make Arcade correctly construct the URL? Also, more generally, is there another way of letting users open Google Maps without recurring to custom widgets and Arcade?
Many thanks!