Opening experience builder at a specific map extent from another app.

186
0
04-17-2024 08:57 AM
Labels (1)
SallyBurnham
New Contributor

Hello,

I’ve come across an issue with experience builder and wonder if anyone else had the same issue? I have another app that when the user clicks on a button it opens a web app in a new tab at the same map extent. Using the current map extent expression below.

var mapextent = $currentMapExtent;

return {

    url: "//apps/webappviewer/index.html?id=e319dcbdf9d34cd18cbf27d4e1f3c41f",

    method: "get",

    display: "launch",

    query: {

        extent: mapextent.xmin + "," + mapextent.ymin + "," + mapextent.xmax + "," + mapextent.ymax + "," + 27700,

        valueB: "Value B"

    },

    form: null

};

 

The issue is as web app is going to be retiring, we are looking at moving across to Experience builder and the above script doesn’t work in experience builder just opens the default map extent. Looking at online documents URL parameters experience builder https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm#ESRI_SECTION1_E5A5... it doesn’t mention current map extent only mentions centre a map using centre, X, Y and projection.

So I have changed the script to get the centroid x and y location

var x = centroid($currentMapExtent).x

var y = centroid($currentMapExtent).y

 

return {

    url: "//experience.arcgis.com/experience/6a13b54abeb94084a4fd7d32a167e080/",

    method: "get",

    display: "launch",

    query: {

         centre: x + "," + y + ","+ 27700,

        

    },

    form: null

};

 

It opens up the experience builder app but it doesn’t open at the same map extent it opens the default map location. I’ve tried changing some of the script around like centre for extent, removing projection etc but I can’t get it to work. Annoyingly when looking at the experience builder URL address it has the map location easting, northing and projection of where I want the map to zoom to.

https://experience.arcgis.com/experience/6a13b54abeb94084a4fd7d32a167e080?centre=494747.1409685446%2...

 

What I am missing is it something simple or is this function not yet available in experience builder?

 

Thanks

0 Kudos
0 Replies