Select to view content in your preferred language

New Map Viewer Set Default Extent

9979
11
Jump to solution
07-22-2021 08:28 AM
Labels (1)
GraceAnneIngham
Occasional Contributor

I set the extent of my map under my Map Settings, but cannot figure out how to get the extent that I created to be used as the default when the map is loaded (i.e. if you click the home icon). 

1 Solution

Accepted Solutions
wayfaringrob
Honored Contributor

Nevermind. I did some more searching and it appears the only way to do this now is within AGO Assistant. Here's how:

  1. Head to https://ago-assistant.esri.com/ and log in.
  2. Click "I want to..." then "View an item's JSON"
  3. In the left, navigate to the map whose extent you're looking to copy. Select it.
  4. The right will populate the item's JSON. Under 'Data,' you're looking for a code block that looks like this, probably toward the end. (Ctrl+F and search for initialState or viewpoint, etc.)rburkebsrc_3-1646255835460.png
  5. Copy the 4 lines that include xmin, ymin, xmax, ymax (like above).
  6. Navigate to the other map(s) that you're looking to copy the extent to. Click "Edit JSON" in the top right of the Data box. Find the same code block and paste the values over those 4 lines. Save, repeat for any other maps, and you're done! You'll still need to be careful to click "Home" before each time you save, or re-do these steps if you accidentally bump it.

There is an idea open that suggests re-implementing this functionality in AGO. Can you weigh in on what's going on, though, @RussRoberts? It would be great if that old blog post were at least updated with instructions for doing this in AGO Assistant if this functionality isn't coming back. If I didn't know a thing or two about JSON I would had no idea how to do this.

View solution in original post

11 Replies
RussRoberts
Esri Notable Contributor

If you refresh the page after you save does it honor the set map extent?

0 Kudos
GraceAnneIngham
Occasional Contributor

Refrashing didn't work but when I view the map on a smaller screen size then it is zooming in to the extent that I set....I think that it may have to do with viewing the map on a really large monitor? On the big monitor it is looking at the correct area but with a lot of extra space surrounding the extent that I had set.

0 Kudos
RussRoberts
Esri Notable Contributor

Oh I think I miss understood where you were setting the extent. the extent you set under the settings at the item level is just used for item searching.

 

If you want to preserve the map scale and viewpoint of the map you can set that within the map viewer.  Checkout this doc link. If you view the map on 4.x web apps in desktop and mobile browsers both will have the same starting point without adjusting the scale when you set the save on the map with the view point. https://doc.arcgis.com/en/arcgis-online/create-maps/set-map-properties-mv.htm#ESRI_SECTION1_D2850B49...

0 Kudos
wayfaringrob
Honored Contributor

@RussRoberts, I'm not finding that setting to be particularly useful. I want an extent preserved, not a scale, and I don't want to have to carefully position my map each time I save. From this article, it sounds like the setting on the detail page used to control the default map extent. That's the setting I need. Is that available somewhere? The descriptions of the settings on the detail page and map properties are a little unclear, and neither seem to do what I need.

wayfaringrob
Honored Contributor

@RussRobertsis the functionality described here available somewhere? Having to 'eyeball' several maps isn't very easy, nor does it result in a professional-looking product. I'm having trouble understanding why this was removed.

0 Kudos
wayfaringrob
Honored Contributor

Nevermind. I did some more searching and it appears the only way to do this now is within AGO Assistant. Here's how:

  1. Head to https://ago-assistant.esri.com/ and log in.
  2. Click "I want to..." then "View an item's JSON"
  3. In the left, navigate to the map whose extent you're looking to copy. Select it.
  4. The right will populate the item's JSON. Under 'Data,' you're looking for a code block that looks like this, probably toward the end. (Ctrl+F and search for initialState or viewpoint, etc.)rburkebsrc_3-1646255835460.png
  5. Copy the 4 lines that include xmin, ymin, xmax, ymax (like above).
  6. Navigate to the other map(s) that you're looking to copy the extent to. Click "Edit JSON" in the top right of the Data box. Find the same code block and paste the values over those 4 lines. Save, repeat for any other maps, and you're done! You'll still need to be careful to click "Home" before each time you save, or re-do these steps if you accidentally bump it.

There is an idea open that suggests re-implementing this functionality in AGO. Can you weigh in on what's going on, though, @RussRoberts? It would be great if that old blog post were at least updated with instructions for doing this in AGO Assistant if this functionality isn't coming back. If I didn't know a thing or two about JSON I would had no idea how to do this.

RussRoberts
Esri Notable Contributor

Yup this is bc the application creates the extent based on 3.x older spec and the 4.x has been updated to use viewpoint. If we update the extent app to move to the New Map Viewer way this would impact classic based map viewer maps using this widget to define the extent. 

0 Kudos
wayfaringrob
Honored Contributor

So, regardless of what's going on under the hood, there could still be a way to offer the option of setting the "viewpoint," then, based on coordinates, no? In a similar fashion to setting extent in MVC? If the capability is there and modifiable in the JSON, why was the UI for making these modifications removed? It's just baffling to me that we now are told to rely on eyeballing it or knowing JSON when it used to be such a simple task and still could be. The disappearance of this functionality has been a headache.

cpbride2020
Occasional Contributor

This is about the coolest thing I've ever seen for AGOL. This is going to help me immensely.