Using Near Me Without Looking At Near Me: Triggering Near Me From A Search Bar And Sending The Results To A List (Also, Hidden Widgets)

4124
9
01-19-2024 12:18 PM
JeffreyThompson2
MVP Frequent Contributor
8 9 4,124

When Near Me came out last summer, I was pretty excited. At the time I was working on a public facing application where people could filter a list of parks by their amenities to figure out which one they should go to. And it would be so nice, if they could put in their address and get the list sorted by their location. But, I was very disappointed by the actual implementation of the Near Me Widget. I wrote up my complaints on the ideas board here, but to summarize I just don't like the user interface of Near Me, especially for a public facing application, and I don't want to give up more screen space to Near Me when I already have a well-designed List Widget. I ended my rant on the Ideas board with this:

For my application, the ideal Near Me widget would just be a search bar with a current location button next to it. The user could enter an address or press the button and see the results in the list widget.

Well, since the October 2023 ArcGIS Online update, it is now possible to build that (or something pretty close to it). Here's how...

Step One: Triggering Near Me From Search

For this recipe, we will need a Map Widget, a Search Widget, a Near Me Widget and a List Widget. Let's drag them all into our Experience now and we'll set them up as we go. Start with your Map Widget and select the webmap you want to use. Then, go the Search Widget and pick a locator source. You'll also want to open the Search Suggestion options and check the Use Current Location option.

JeffreyThompson2_0-1705682163840.png

In the Action Tab, add a Record Selection Changes > Near Me > Set Location Action. (A Map > Zoom To Action is not necessary, but you'll probably want it, too.)

Step Two: Set Up Near Me

First, I select my Map Widget. At this point, Near Me will display this scary and confusing warning.

JeffreyThompson2_2-1705683787701.png

This is normal. Near Me is asking you to click on the name of your map again to open up the Analysis settings menu.

In the Analysis settings menu, pick Specify a location, set some sort of buffer distance (I went with 5 miles.) and the click the Add Analysis button. 

JeffreyThompson2_1-1705683701917.png

In the next window, I picked Analysis Type > Proximity and Sort features > Distance. (I also turned off Highlight results on map.)

JeffreyThompson2_3-1705684445191.png

I also opened the General Settings and set the Sketch Color to rgba(255,255,255,0). (Translation: transparent white.) In testing, I found that the default transparent option made a dark grey circle that was actually still very noticable, but by using transparent white there was just a faint dimming of the map and a barely visible edge of the circle.

Step Three: Send Near Me Results To A List Widget

In the List Widget, click Select Data > Outputs > Near Me > Whatever I Named My Near Me Output. (I'm also going to add a No data message to tell the user to use the Search Widget.) 

JeffreyThompson2_0-1705688892256.png

And there we go, when I search in the search bar the data will be transferred to this List. Style up your List Widget as you see fit. (Here's a post about all the various List Widget options.)

But, why? What was the point of all of this?

  1. A well designed List Widget just looks better and is easier to use than the Near Me Widget interface.
  2. Now that the data is in a List Widget, I can do all the stuff that the List Widget can do including, but not limited to, searching, sorting and filtering within the list, sending to a table, and exporting as CSV, JSON or geoJSON. Near Me can only do one of those things: download as a CSV.

Step Four: Hiding Near Me (Hiding The Widget, Not Hiding Close To Me. That's Creepy. Don't Do That.)

At this point, we have a Search Widget that automatically fills Near Me results into a List Widget. We don't need to look at the Near Me Widget anymore. So what can we do with it? Delete it? Send it to the Pending List? Stick it in a Section or Widget Controller? No, doing any of those things would break this build. We are going to do something far stupider. We are going to make it tiny. In the Style Tab of the Near Me settings, set the Width and Height to 0px. Experience Builder won't truly honor my 0 x 0px request. It seems that the true minimum widget size is 16 x 16px.

JeffreyThompson2_1-1705691421127.png

See that tiny box I circled in red. That's my Near Me Widget. It will happily do its job even if the user can't read anything in it. Should I need to alter any of my Near Me options later, I can click my little box and the settings panel will appear.

If I was on Developer Edition right now, I'd add this to my CSS to make that little box vanish completely.

 

.widget-near-me {
   display: none;
}

But we all know using Developer Edition is cheating, what can we do in ArcGIS Online?

Well, we could be happy with our tiny box taking up some unimportant part of the screen, but if you really want it hidden. You can use a Sidebar Widget.

I've put my tiny Near Me Widget in the collapsable side of a Sidebar Widget. Set its size to 0px, Default state to Collapsed and turned off the Collapse Button.

JeffreyThompson2_0-1705692929103.png

Tiny Near Me will happily keep doing its job banished to an undefinably thin, unopenable Sidebar Widget and your users will never know exists (unless they inspect your page with their browser's Dev Tools).

I have found hidden custom widgets to be very useful before, but this is my first time hiding a default widget. I've had a flood of ideas during the writing of this post (including that unopenable Sidebar trick) and I think there may be some sequels to this post coming soon. What could you do with a hidden Views Navigation or Timeline Widget? 

I am making my demo app publicly available, so you can decide if a Near Me-free Near Me is right for you. The big downside is that I can't find a way to make my List Widget a list of all parks in absence of a Near Me search. (I attempted using the Filter Layers To Only Show Results option within Near Me, but did not get the results I wanted.) Another potential downside is reducing the end user's Near Me options. This demo still doesn't work well enough to have been used in my original park application, but in my opinion, it is a lot closer.

 

9 Comments
Alan_Halter
New Contributor

This was incredibly helpful. Thank you! I too have found the Near Me widget doesn't behave as one might expect when compared to other applications we use almost daily like Google's simple locator search bar or any number of store finders you'd find online (especially when ordering food).

I second all the issues described. I will add
1) When an address is entered in the search bar and the Near Me widget runs its magic, you would expect the analysis results to simply display a list of nearby locations. However it strangely displays a collapsed summary. You have to click it to display locations. Just show the locations expanded please.

2) Something happens to pop-ups in the analysis results. I've never gotten pop-up details to display as expected in the Near Me widget.

Adding a List widget in place of the Near Me window is a great work around. The window kinda takes up valuable real estate and doesn't really lend itself to any intuitive design. It just hangs out there waiting to be activated or poked by a curious user. I found I had to write specific instructions for users to utilize Near Me and anytime I have to do that it's virtually unusable for non-GIS users. I've got about 5 seconds to hook my audience and prove to them my app is a beneficial wayfinder before they give up and simply Google the info they need. It's just unfortunate users have to stumble over the Near Me widget to get location info. There's so much potential with this widget.

JeffreyThompson2
MVP Frequent Contributor

JeffreyThompson2_0-1726690414779.png

@Alan_Halter The Expand Analysis Results option should take care of your first complaint.

Alan_Halter
New Contributor

Regarding the List widget results, is there a way to configure Near Me and Filter widgets so the user’s List results remain the same regardless the order of operations executed? For example, filtering then searching an address vs. searching then applying a filter--Near Me spits out a different number of results. The former seems to provide expected results while the latter doesn't actually filter out Near Me results. It looks to only be filtering the features on the map. Ultimately, there's a discrepancy b/w the number of features displayed in the map vs. features displayed in the List widget.

JeffreyThompson2
MVP Frequent Contributor

@Alan_Halter Using the List/Near Me configuration above, the List Widget will show the output of Near Me. If a filter is applied after running Near Me, it won't trigger an update to Near Me, so the List Widget will still be showing items that might be filtered out of the Map. 

JeffreyThompson2
MVP Frequent Contributor
JaredPilbeam2
MVP Alum

@JeffreyThompson2 Looks like some data is missing in your demo app.

JeffreyThompson2
MVP Frequent Contributor

@JaredPilbeam2 It's still working. It was re-designed in the sequel to this post to take advantage of some new options.

https://community.esri.com/t5/experience-builder-tips-and-tricks/has-arcgis-online-caught-up-to-deve...

CaseySloan
New Explorer

@JeffreyThompson2 , this is a great solution! I do have one issue that you might be able to help with: I am trying to use this functionality to return info on a polygon feature in a layer that the searched address falls within. I only want the one feature's info returned in the list widget, so I was setting my search distance in the Near Me widget to 1 foot. Unfortunately, the map then automatically zooms to the extent of the near me search (i.e., a one foot radius of the searched address). I can't figure out a way to adjust this zooming. What I would really like the app to do is return info on a single polygon feature in the that the searched address falls within and have the map zoom to the extent of that feature. Any suggestions? Thanks in advance for your help!

JeffreyThompson2
MVP Frequent Contributor

@CaseySloan Check out the Zone Lookup post. It's also something of a sequel to this post. It shows how the Search Widget can be used to find polygons with Near Me.

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