Zoom to location via URL

201
4
12-16-2021 11:04 AM
HelenCooper
Occasional Contributor III

Hi all, 

Following on from my earlier question, I'm trying to work out if it would be possible to zoom to a map location using a URL. 

Thanks to @jcarlson I can pass a selected feature via the URL, and next I'm trying to zoom to that feature.

Any pointers gratefully received!

Thanks, 

Helen

0 Kudos
4 Replies
jcarlson
MVP Honored Contributor

It's possible, but depends a lot upon the configuration of the destination map, and what fields you have available in your features.

Google Maps, to use as an example, takes locations as part of the URL:

https://www.google.com/maps/@<lot>,<lon>,13z

But this would only work as a URL link if the location were available to me as attributes in the feature.

One of the downsides of Experience Builder is that Arcade expressions are not available, so dynamically generating the URL from the feature geometry won't  work. You could still get that link to generate in a popup expression, but it won't be a nice Button widget.

- Josh Carlson
Kendall County GIS
HelenCooper
Occasional Contributor III

Thanks Josh, 

I'm trying to get it to work with a map within EB - I've put a rough example together here: 

https://experience.arcgis.com/experience/95e2ca6befde4ae4809f7b9b7da70f1a/

So if you click the 'URL with attributes' button, it will load a page with a map and select a feature on the map, but I can't seem to get it to zoom in to the selected feature automatically. 

0 Kudos
jcarlson
MVP Honored Contributor

Kudos on using the Dymaxion projection! I rarely work at scales where "fun" projections even matter.

But to your issue: if the map is a Map Widget in EB, there's a way to set up a Message Action. But this only works with widgets that allow record selection, like a list or table.

jcarlson_0-1639686871645.png

 

- Josh Carlson
Kendall County GIS
HelenCooper
Occasional Contributor III

Thanks Josh, 

It's very rare for me to be mapping in anything other than British National Grid, so I hear you!

It is a map widget, but I can't see any message actions associated with the map (only the associated list). I'll keep exploring, it might be that I can get the list to be the 'thing' that's selected when I first load the page, and then use that to trigger a message action to zoom the map... 

I've also just experimented with having the map zoomed to a custom location within the settings, so it stays at that zoom level but moves around when it first loads... it kind of works but is a little clunky!

It's getting late here so I'll pick this up again tomorrow. 

Thanks again for all your help, really appreciated. 

Helen

0 Kudos