Select to view content in your preferred language

Opening an app in a defined location

141
7
Jump to solution
Wednesday
Labels (1)
SimonCrutchley
Frequent Contributor

This may well be impossible, but I was wondering whether there was a way to open an app in a specific location based on parameters in a URL etc.

What I'm trying to do is to have a national app showing aerial photos that can be accessed via a number of different regional hubs built by another part of the organisation. The idea would be to go to the app from say the Devon web page and it would open focussed on Devon, whereas if you came at it from Yorkshire, it would open focussed on Yorkshire.

Is this possible, and if so how would I go about it?

Thanks

0 Kudos
1 Solution

Accepted Solutions
JeffreyThompson2
MVP Regular Contributor

There is a hack for this.

  1. Add a Share Widget.
  2. Open up Preview Mode.
  3. Get your map set the way you want.
  4. Open the Share Widget.
  5. Turn off Short Link.
  6. Copy the URL.
  7. Remove "?draft=true".
  8. When you have all the URLs you need, you can delete the Share Widget.
GIS Developer
City of Arlington, Texas

View solution in original post

7 Replies
JeffreyThompson2
MVP Regular Contributor

It is possible to use URL parameters to control your map.

https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm

Center a map

To center a map on a particular location, usecenterfollowed by the desired coordinates and the desired coordinate system's well-known ID(WKID). The following are examples:

https://experience.arcgis.com/experience/<AppId>#<mapWidgetID>=center:<x,y,wkid>
https://experience.arcgis.com/experience/<AppId>#map_1=center:-10373125.398783844%2C4598516.55871741%2C102100
GIS Developer
City of Arlington, Texas
0 Kudos
SimonCrutchley
Frequent Contributor

Hi there, that looks promising. Can you also set the scale, as unfortunately the counties vary in size quite a bit?

Also having just tried it I'm afraid I'm not fully understanding the various elements. I take it that the App id is the 32 character string, but what's the mapwidgetID? Is that just the name that I've given to my map?

Assuming my App ID is 68347442a9b54fe9a2d2d7a09dabf525, my map is call Aerofilms and the centre I want is 433019 429554 in British National Grid (WKID 2770) would it be

https://experience.arcgis.com/experience/<68347442a9b54fe9a2d2d7a09dabf525>#<Aerofilms>=center:<433019,429554,27700> or should I not be using the <>s?

When I try that I get 'Item does not exist or is inaccessible.' so i'm clearly doing something wrong.

Sorry

0 Kudos
JeffreyThompson2
MVP Regular Contributor

Yes, remove the <> characters. You will also need to enable the URL Parameters from the settings within Experience Builder.

JeffreyThompson2_0-1728483668428.png

Look for the Define Map Viewpoint section on the page linked above for more complex options.

GIS Developer
City of Arlington, Texas
0 Kudos
SimonCrutchley
Frequent Contributor

Right. I removed all the <>s and it took me to the map. Unfortunately, whether I used Leeds in the north-east, or Truro in the south-west, it just took me to the full extents, so I'm clearly missing something.

0 Kudos
SimonCrutchley
Frequent Contributor

I've set the URL parameters for Map to on, and I've looked at the 'Define Map Viewpoint section' but I'm afraid I don't understand what it all means and how to get from the JSON format to the URL. I guess if I could get one example to work, I could tweak for others, but I'm not getting anywhere. No matter what I enter, I just get a full screen.

I even tried zooming somewhere else and copying the URL, but this has two of everything and I don't understand what it's referring to and how to edit it

https://experience.arcgis.com/experience/68347442a9b54fe9a2d2d7a09dabf525#map=viewpoint:%7B%22rotati...

Sorry

0 Kudos
JeffreyThompson2
MVP Regular Contributor

There is a hack for this.

  1. Add a Share Widget.
  2. Open up Preview Mode.
  3. Get your map set the way you want.
  4. Open the Share Widget.
  5. Turn off Short Link.
  6. Copy the URL.
  7. Remove "?draft=true".
  8. When you have all the URLs you need, you can delete the Share Widget.
GIS Developer
City of Arlington, Texas
SimonCrutchley
Frequent Contributor

Brilliant and simple. Thanks 😊

0 Kudos