How to customize Search Widget to show feature pop-up?

8870
23
Jump to solution
09-01-2017 06:00 AM
by Anonymous User
Not applicable

Hey Team!

What I'm trying to do is fairly straight forward (conceptually), but I'm unsure about how to put it into practice. 

If you go to a Web Map or App (ArcGIS Web Application) and use the Search Widget to find an address (2003 Union St), you'll get a pop-up that just identifies the location. I'm looking for the functionality of: a user searches for 2003 Union St (or whatever street) and the pop-up returned corresponds to the Parcel feature. 

Some of the concepts were touched here: Configure Popup for Search Results and here: Program search widget to pop up window from intersecting polygon layer , but there was no answer that addressed how to modify the Search Widget code to achieve this functionality. 

Any help is much appreciated!

23 Replies
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   Yes, the D:\applications\VirtChar\VirtChar\InDevelopment\Beta\widgets\Search\config.json is only used if you di not make any settings changes to a widget. Once you have made a settings change then the json that is used will be in the apps configs folder D:\applications\VirtChar\VirtChar\InDevelopment\Beta\configs\search\search_config.json.

AustinKolar
New Contributor

Robert-

I have only been working with ArcGIS for a couple of months and I have very little to no experience in Javascript. I am wanting to get this exact situation accomplished in one of my WAB. However, when I attempt to edit the Search widget.js file it is not changing any results on my WAB search results (no errors nor change from original popup). I was wondering if there is any methods to adjust the search results in a GUI framework or if can only be done via Javascript? If only done in Javascript can you help dumb down these steps directions for a non experienced javascripter wanting to learn?

0 Kudos
by Anonymous User
Not applicable

Hi Austin, as an update I am happy to report this method has worked for us.  I use it on www.sagis.org/map  I set it to zoom close in Search config. What it does, in a nutshell, is it fires a click event on the result, which will therefore show the feature's popup.  In our case, I have configured the webmap popup on our Parcel layer.  This is the path to the modified widget Javascript file: https://www.sagis.org/map/widgets/Search/Widget.js?wab_dv=2.12   The code blocks to add are surrounded and denoted by /// robert s   (in my apps search for robert s and/or kevin m to see modified code blocks as it is many thanks to Robert for most of them)

0 Kudos
by Anonymous User
Not applicable

Greetings Robert Scheitlin, GISP ... Your method from a corresponding thread works perfectly.Modify Search Widget to use Popup from Web Map  -> pops up the result, after clicking the second time, on the actual Result.  Here is my example: SAGIS Property Map Viewer

 

 

It would be complete, if it can trigger the popup in one click, upon a user clicking the Suggestion's result item. (In addition to clicking the final result like the first thread). 

So, next I modified the widget as you describe in the thread here. Works perfect.  SAGIS Property Map Viewer   

Sort of. I realized an issue.

I was like, hey, cool, works.  Then I noticed it wasn't the right parcel in the popup. It was the popup from a few blocks away! It highlights the other parcel far away as well.   I think I know the why. Just not the 'how' to fix.  So, I have the parcel layer in my web map twice. One parcel layer, is the regular parcel layer where the lines are green. It turns off at the Streets level of detail. I then cut over to the parcel layer where the symbology is transparent at Streets scale and above. Thus, it will give a popup but not obscure the county in parcel symbology when out at a broad scale.  I thought this was nice, kind of mirroring how when you click Google Maps it identifies by default. I hid the transparent layer in my Layer List fyi. Now, this second transparent parcel layer is what your code in this thread hits. I noticed this, because initially it was giving 1,000 results each time. Of course. Because it fires at broad county scale, loads the popup, then and only then, it zooms. Therefore, I went to the service and ratched the Max Records count down to 1.  So, it works, in that now it only returns one record's popup, except it clicks the wrong parcel.

 

Also, I noticed it does in fact work and selects the right parcel if it's already zoomed down to block level. But not when zoomed out, which I believe, is due to this odd sequencing of events in the widget logic.

 

For example I test "1 E Bay St" when still at the full home extent of the county. It displays the popup for 5 W Broughton St.  In F12,  mpPt and scrPt were -9027017.497, 3773899.188 and 682, 207 respectively. mpPt has the correct wkid 102100. 

 

I looked around to see if there was some sort of pixel or map unit tolerance to ratchet down to as close to zero as possible but didn't see anything. Nor could I see why the sequence of events was kind of odd. I would have thought the widget would want to fire the popup only after zooming in, but apparently it doesn't, and I couldn't see how I could make it do that in that order. 

Thoughts? Would you advise continuing to look for a tolerance setting? Or perhaps make your modification here triggered only after zoom-to? 

Also, I tried putting in _zoomToScale and others, no effect, in fact even an alert('test') didn't trigger in that func. Also I noticed sometimes this stops working, with both methods. After searching a few addresses, clicking and panning around a bit, sometimes it won't display the popup just the little black graphic point. 

webmap: https://sagis.maps.arcgis.com/home/webmap/viewer.html?webmap=320d9ad1de214afba0d378ff659a8558 

Locators: Folder: Locators 

0 Kudos