URL Parameters with Experience Builder - Send Your Users!

11803
18
01-20-2023 08:01 PM
BrianBaldwin
Esri Regular Contributor
9 18 11.8K

Experience Builder recently (in the last release) included the ability to have a few different URL parameters. Honestly – URL parameters are nothing that I have used… but I’ve found that they can be really valuable to provide a targeted way to drive viewers to a specific feature or location.

If you want to look at the current URL parameters for Experience Builder, the documentation can be pulled up here: https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm

If you peruse this list, you’ll see it’s short on map specific URL parameters. Notably, one of the questions/needs I had from a user was related to loading up a feature at a specific zoom scale.

Currently, Experience Builder does not include a URL parameter for an ‘extent’ or ‘scale’ – so it seemed that there was no way to load a selected feature and then ‘zoom to’ with a URL. Yet, using the ‘pages’ functionality of Experience Builder – there is a workaround for creating a standard app that also has a ‘url parameter zoom to specific feature’ functionality.

In my example – I have a basic web application showing the street network of San Bernardino County. The app works, but I also want the ability to send users to specific street segments when the app opens. So… how can I do it without the ‘zoom’ url parameter?

Here is the link to my app – feel free to play around with the parameters/URL as well: https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/

 

1 - Main App.PNG

 

The first trick – is to use the ‘page’ functionality that is found in Experience Builder. After I have my application built out, I just duplicated it under the pages section.

 

1 - Duplicate.PNG

 

You can then rename your pages, which will be used in the URL. After you have your second page created, go to the settings for the map object and modify the initial view of the map. It doesn’t matter where you focus on, just what zoom scale you use.

 

3 - Initial View.PNG

 

After you have done this, you are basically done. You can save and publish your app.

The first URL parameter is simply the ‘page’ parameter – my original/normal app can use the default URL, or the URL to the specific page as shown here:

https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/page/Full

But if I want to drive users to a specific feature at the zoom scale I pre-defined, I need to use the other page that I created along with the details of the specific feature. For my app, the data, and my feature, that would look something like this:

https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/page/Zoom?data_id=3b8b7d77...

If I want to change the feature that gets selected in the map, I can modify it manually, or you could do this programmatically as well. If you want to play with it manually, just modify the last characters in the URL following the ‘A’ character. This is the ObjectID for the feature.

For example, take the URL: https://experience.arcgis.com/experience/29285b535d614faaa60b599fc111d775/page/Zoom?data_id=3b8b7d77...

Then replace ‘50965’ at the end of the URL string with ‘50089’, ‘32219’, or try any number!

 

URL Parameters.gif

 

That's it! Hopefully this helps a few people utilize URL parameters and a little Experience Builder trickery to create an experience that is tailored to your users needs.

18 Comments
KansasGeologicalSurvey
Occasional Contributor

Great how-to, I used this on a test map and it's working well. Thanks!

Is there a way to zoom to a feature using a non-object ID field? Like a way to pass in an in-house ID number instead of the AGO object ID?

BrianBaldwin
Esri Regular Contributor

Great question @KansasGeologicalSurvey - right now - it does not look like that's possible - but I'll see if @Jianxia or someone from the ExB team can help answer the question - or let us know when that type of capability might be available with URL parameters. Thanks!

Jianxia
Esri Regular Contributor

@KansasGeologicalSurvey Support for App URL parameters in Experience Builder is planned for Q4 2023. See Experience Builder 2023 roadmap.

PaulGiroux1
Regular Contributor

Have you been able to get this to work with editing widget? In my app, when I pass the id in, it selects but it does NOT trigger a zoom. It does select the feature on the map and in table but does NOT trigger a change on the Edit or other widgets on the page.

It's sorta half working. Is there something I need to config in Web Experience Builder itself?

Maybe I'm missing data actions and bindings on the map widget or something?

Selection_half_a__ed.JPG

 

BrianBaldwin
Esri Regular Contributor

@PaulGiroux1  - I finally got around to testing this and I am seeing the same thing. In my test - if I 'click' on the feature to cause a 'pop-up' action to take place - it will then pass that over to the Edit widget as a selection - as expected.

BrianBaldwin_1-1676064531229.png

 

Yet - if I use that same 'selected feature' URL - it will not recognize the feature as selected - even though it's highlighted.

BrianBaldwin_0-1676064418311.png

Is this the expected behaviour @Jianxia?

AndreasHall
Esri Contributor

Great resource Brian! I found out this the hard way by trying myself, I should just have googled 😅

I had this idea that if I use URL parameters to select an object in, e.g., a list, and then define an action on this list to zoom to this object in the map, I would achieve an zoom-like URL parameter. It took some time to figure out why it zoomed sometimes and not sometimes, it was just because of my saved zoom level and had nothing to do with the actions I was configuring.

PaulGiroux1
Regular Contributor

@AndreasHall , can you  expand on your comment a bit. As you can see in my comment above from 01-31-2023 that I'm still trying to figure it out. Are you suggesting I just have to tweak some Zoom level somehow and then it will successfully trigger the selection?

AndreasHall
Esri Contributor

As I understand it, the data_id parameter selects objects and make the map pan to the object, it does not trigger any actions set on the different widgets in your app. I have only tested if I can get the app to open with the map zoomed to a specific object and it is possible following Brian´s instructions above. By having two different maps in you app, saved with different default extents (and zoom levels), you can create the impression of the app zooming to a selected object, but actually it is just opening a different map that that shown as standard and panning to the object in question. I have not tested your specific workflow, my comment was regarding Brian´s original blog.

GeeteshSingh07
Frequent Contributor

@BrianBaldwin, it's a wonderful trick...thank you so much for consolidating it and making it easier for us to understand.

My question remains the same that is it possible for non-ObjectID field? 

I am able to select/query the point using these URL parameters:  https://experience.arcgis.com/experience/fd354455c7154e8d8a554f7c6da465ba/?draft=true#data_s=where:d...:UID='3b8fdd93-3489-47cd-82c2-81b483bc53fa'

However, it doesn't zooms in to the point. 

IT_DeptDept
Emerging Contributor

@BrianBaldwin @GeeteshSingh07 

It looks like Brian's (OP) post references the FID field, not the ObjectID field. I wonder if the URL ID parameter references whichever field is considered the primary ID field?

BrandonGuo
Regular Contributor

@GeeteshSingh07 You can use the where parameter to select non-object id field.  

 

/page/Zoom?#data_s=where%3A..........%3A[field]='query'

 

TimConfare2
Regular Contributor

Apparently if you have the developers version of EB then the url parameters are structured differently.  For example, mine is "...../?page=AccessDane&....".  However, the parameter to select non-object id field does not work outlined by @BrandonGuo .....unless I am missing something.

TimConfare2
Regular Contributor

@AndreasHall I did finally get this working, however, it does not automatically pan to the selection.  I created a separate page and set up a scale but if it doesn't at least pan than I think this method is not useful.

AndreasHall
Esri Contributor

Which version of Experience Builder are you using? I have only tested in ArcGIS Online.

Here is an example.

URL without data id parameter: https://experience.arcgis.com/experience/0cda331b701c4868b8fa30f1bf7d5c35/page/Page/?views=Site-deta...


URL with data id parameter: https://experience.arcgis.com/experience/0cda331b701c4868b8fa30f1bf7d5c35/page/Page/?views=Site-deta... 

Be aware that if you are using a two map setup, with identical data in them, the data will have different IDs in these two maps.

TimConfare2
Regular Contributor

Thanks for the reply.  I'm using the developers version 1.14.  This is the url that worked for me:

......./#data_s=where%3AdataSource_3-18f5f21b919-layer-2%3Aparcelno%3D'071105362921'

 

It selects the parcel and even adds the popup attributes to the Feature Info widget I have in my sidebar...however, it doesn't pan to the selection (I know it won't zoom as that is not available).

IT_DeptDept
Emerging Contributor

It looks like this functionality has progressed even within the last two months. I am able to now pass parcel id's through the url quite easily in several of the new instant apps. Looking specifically at "Sidebar", and you can even choose the field to be used and give it an alias in the app config settings. 

I have put this app together just to test:

https://brookline.maps.arcgis.com/apps/instant/sidebar/index.html?appid=ddd8e78f154b4523b5d639367e04...

I have not tried the other new URL parameter options yet, and have not tried any of them in Experience Builder.

Reference blog has also been updated recently:

https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/using-url-parameters-in-web-apps/ 

 

TimConfare2
Regular Contributor

They won't work in Experience Builder, those are for the instant apps.  I do have a ticket with tech support to see if there is a workaround until the supposed addition of 'select and zoom' url parameters in the June upgrade of EB is available.

ArunChetty
New Contributor

Hi @TimConfare2 , any luck related with the panning using data_s=where? I'm trying something similar and it's selected but not automatically panning to the object?

Thanks

@Jianxia , any help would be appreciated

About the Author
Brian works as a Lead Engineer at Esri to support customers in Education. Brian has worked as a lecturer in GIS, supported non-profits through his community planning work, and honestly just loves working with users to help solve their geospatial quandaries!