Printing A Map You Can't See - Or Why Would Anyone Hide A Map Widget?

212
0
11-12-2025 08:47 AM
JeffreyThompson2
MVP Frequent Contributor
1 0 212

Is this the strangest thing I've done? Maybe, I don't know. I've done some wacky stuff.

Challenge

  • Once upon a time, another developer here made a very good Public Notification Tool in using the ArcGIS Pro SDK.
    • Better than anything I could hope to make in Experience Builder, even with unlimited time.
  • ESRI is adjusting their licensing and pricing model in ways that will effectively give us fewer licenses at a higher cost per license.
    • So we are adapting by looking for ways to use less licenses, like moving some staff off ArcGIS Pro and onto web apps.
  • Personal Goal: Do not write any code for this project.
    • A year and a half ago, I wrote it's totally possible to make a Public Notification Tool in default Experience Builder, so I needed shut up and prove it.
    • I am competing with an existing, fully-functional, objectively better option, so I didn't want to put in too much effort only to be told they would rather just pay ESRI to stick with our current tool.

Solution

Used Near Me in Experience Builder to create a Public Notification Tool. I did it pretty much exactly the way I said to do it in that other post. It works. Good night.

...The Actual Challenge This Post Is About

"Ok, it's pretty good, but we need to be able to print a map with the buffered area and also a map with just the selected parcel highlighted with a yellow outline."

Near Me doesn't have an option to hide the Buffer/Sketch Area. It can only be cleared by clearing everything in the Widget. Nor is there an option to turn these things off completely. There are times such options would be useful. **Cough**

What If You Could Hide A Map Widget?

This isn't Fantastic Widgets and Where To Hide Them, the title I now deeply regret not giving to this post. No, you really can't hide a Map Widget. Good night.

...But you can disguise a Map Widget. Depending on how you build, the user may not have any idea you are using two maps unless that carefully examine the URL bar in their browser and can read Experience Builder. I've found at least three related versions of this build that could all be useful in certain circumstances. They really must be explained in order to make sense, but don't think that one version is inherently greater than another. Feel free to step off the elevator at floor one, if it suits you best. I did.

Grouund Flouour: The Extra U's Are Four The British Flouour Numbering

Do you really want to get on this ride? Are you sure? It gets weird. Ok, here we go.

I've already created a project with a Map, Near Me, Search, and Print Widget and configured them so they make a functional Public Notification Tool. I've renamed my Map Widget to Working Map and my Print Widget to Print Working Map. My Crude Demo App currently looks like this.

JeffreyThompson2_0-1762807618269.png

Floor 1: With A Button Switcher

Now, we slightly break stuff for a moment, as we send Working Map to the Pending List. And Add a Section Widget in its place. Rename this View Something You Don't Mind Being In A URL. Drag Working Map out of the Pending List and into the Section Widget.

Add a Button Widget inside the Map Widget and give it a Text of Hide Buffer Area. It's easiest to do this now, but if you're going to a higher floor, you may not want to do this.

Go back the Section Settings Panel and Duplicate Something You don't Mind Being In A URL. Then rename it to Something Else You Don't Mind Being In A URL.  Click the Map Widget and rename it Display Map. In the Options Submenu, set the Highlight Fill to transparent and the Highlight Outline to yellow. In the Action Tab, add an Extent Changes >  Working Map > Zoom To Action.

If you made a Button earlier, click the Button Widget and change the Text to Show Buffer Area and Set Link > View > Something You Don't Mind Being In A URL. Switch back to the original View and add an Extent Changes >  Display Map > Zoom To Action to your Working Map Widget and if you've got a Button, Set Link in the Button to the newer View.

Now, add another Print Widget and name it Print Display Map and set its Map Widget to Display Map.

So at this point I have one Map, that looks like the one above, that shows the buffered area and another Map that only has a yellow outline on the selected parcel. (I wish I had an option to make this yellow line thicker, though.) I can click on either map or use the Search Widget to trigger a Near Me analysis. The map areas stay in sync for display and printing purposes.

JeffreyThompson2_0-1762956487497.png

And I can print from either map, here I can show you...

JeffreyThompson2_1-1762956697392.png

...That's not supposed to happen. Here's where we get to the problems. In order to conserve resources, Experience Builder does not load a Datasource until it is actually needed. So, you cannot print a Map until you have viewed a Map, at least once. Once the Map has been loaded, you can print while looking at either Map and the data and map area should match.

Other issues:

  • The drawing tools in Near Me will not work while looking at the wrong Map.
  • Any other Widgets like Draw or Measure that require a Map to function will only work properly with the Map Widget they were configured to work with.
  • You may encounter some awkward zooming effects.

I am working on an internal application where the users can theoretically be trained to workaround and tolerate some less than ideal behavior. And this version has the best load times with an option to turn buffers on and off that works well in this scenario. If we go up a floor or two we can address some of these issues.

Floor 2: Only Show The Display Map

Let's say you are working on a build where you absolutely do not your user to know you are using Near Me and even the faintest Sketch is too much. Or maybe you are trying to handle that issue with the Print Widget without the user needing to do anything. Or you want to do some drawing on the Map without all the Near Me generated distractions. Then this is the floor you want to get off on.

This trick is as stupid as it is simple. Go to the Section Widget and turn on Autoplay. 1 Second Interval and make sure Loop is turned off.

JeffreyThompson2_2-1762962087007.png

To the user the Map will load, then it will flash and load again. And both Print Widgets will work without issue.

Note that this one second countdown doesn't appear to start until the data is fully loaded, which could be a pretty long time. These upper floors will also not load both Maps if the user includes the View URL Parameters to get to the site or just hits the reload button on their browser, which will reload with the URL Parameters included. 

If you made any Buttons to switch you Maps, you may want to delete them.

Floor 3: Only Show The Working Map

On this floor, the Working Map is the primary one with the Display Map being only used for printing. And it's super simple to get here from Floor 2. In the Section Setting Panel, drag the Something Else You Don't Mind Being In A URL View above the Something You Don't Mind Being In A URL View.

JeffreyThompson2_3-1762963582756.png

The Display Map will now load first then switch to the Working Map automatically. To me, this is the ultimate form of this technique and the one I would prefer to use, but it has a major downside. In testing, this version seems load much, much slower than the other options. As in, are you sure this isn't broken slow? And Near Me will be displaying a loading message further making this build look broken. I've got some pretty large datasets in my Map, so maybe this would work better if you have less data?

But maybe being slow isn't such a terrible thing. It appears that Near Me has a bit of a bug where if it is open when the project loads, it can load too fast, before the Map Widget loads and become permanently stuck on a Failed To Load error. This trick holds Near Me in a loading state until the second Map Widget loads and appears prevent such an error.

Can we take this even further?

Floor 4: There Is No Floor 4. You Bust Through The Roof And Now You Own A Chocolate Factory

iadedp4zkh471.gif

Contributors
About the Author
A frequently confused rock-hound that writes ugly, but usually functional code.