Inconsistent Zoom Behavior with URL Parameters

1321
14
10-03-2022 09:53 AM
Labels (1)
ArielLow2146
Occasional Contributor II

I have a Media Map configured with a URL parameter.

ArielLow2146_1-1664815500366.png

 

When I append &district=20 to the app URL the first time it loads it shows the typical map extent but if I refresh the page it loads the app zoomed into the feature I've specified with the URL parameter. Loading the app zoomed into the feature is the behavior I'd prefer. Is there a way to get that to happen on the first app load?

0 Kudos
14 Replies
KellyHutchins
Esri Frequent Contributor

I put together a sample app to try and repro. When I run this app for the first time with the url param and a custom zoom level applied (using the level url param) it zooms to the location and shows the popup. Is this app working for you: 

 

https://jsapi.maps.arcgis.com/apps/instant/media/index.html?appid=5992dbd9607748d595afd948e48cc7bd&l...

0 Kudos
ArielLow2146
Occasional Contributor II

Hi @KellyHutchins. Yes that app loads consistently at the same zoom level for me. When I load this app https://geo.maps.arcgis.com/apps/instant/media/index.html?appid=b085638a28ad4d1498c5777bca5bffe1&dis...without the level parameter is when I see the different zoom behavior on refresh. I tried applying a level parameter but it also resulted in some different zoom levels occurring on refresh. I'll take a look to see if I can figure out some better repro steps.

0 Kudos
ArielLow2146
Occasional Contributor II

Hi @KellyHutchins. I was able to reproduce the behavior I was seeing in the app I shared in my last response. To do so I:

  1. Added the USA Census States layer to a map https://geo.maps.arcgis.com/home/item.html?id=774019f31f8549c39b5c72f149bbe74e
  2. Zoomed to the extent of the layer and saved the map.
  3. Clicked the Create App button in Map Viewer and chose Instant Apps then chose Media Map.
  4. Turned off express mode.
  5. Configured the URL parameter as shown

ArielLow2146_0-1664915974107.png

When I publish and first view https://geo.maps.arcgis.com/apps/instant/media/index.html?appid=52f91e058bca4538a7aae359f1c5847b then add &fips=11 to the URL the first time it loads it is zoomed out but when I refresh it zooms in.

 

0 Kudos
RandyMcGregor3
Occasional Contributor III

How/where are you configuring the url parameter here? In the map or in the app?

Thank you, 

Randy McGregor

0 Kudos
ArielLow2146
Occasional Contributor II

@RandyMcGregor3 I was doing this in the Instant App configuration

0 Kudos
RandyMcGregor3
Occasional Contributor III

Thank you. I had to search for 'URL Parameters' then got a message saying I would no longer be in the some sort of mode (Simple Mode or something) is that OK? and I said, 'Yes.' Thank you for making me aware of this. It appears that Instant Apps have more limited url-based modification options than Web App Builder apps.

0 Kudos
RandyMcGregor3
Occasional Contributor III

Is there documentation about the url parameters available in Instant Apps (as opposed to Web App Builder Apps)? I have Googled and searched and not found any documentation. 

Thank you,

0 Kudos
KellyHutchins
Esri Frequent Contributor

In some apps you can define custom url params in the app configuration. In those apps you choose the layer and field name you want to use. The apps also support defining extent. center, level webmap (or webscene). find and marker. Details about using those params can be found here: https://doc.arcgis.com/en/arcgis-online/reference/use-url-parameters.htm

0 Kudos
RandyMcGregor3
Occasional Contributor III

Here's where I may be missing something and sorry if I'm being slow. The parameters in that link for for web maps. I have been able to find url parameters for web maps and for web app builder web applications (and for dashboards - different configuration), but not for instant apps.

Thank you,

Randy McGregor

0 Kudos