I'm looking for a search feature that allows you to search for an address (point, polygon) and the return results would return any intersecting layers. Anything like that out there?
Leo,
There is no widget out there that I am aware of that does that. But it would be pretty simple to bind the otb Search widget result to launch the Identify widget.
Can the onboard Search widget be modified to execute a popup based on the search result as well?
Leo,
Sure just edit the Widget.js _onSelectResult function (lines 29 to 34):
_onSelectResult: function(e) { var result = e.result; console.info(result); if (!(result && result.name)) { return; } var dataSourceIndex = e.sourceIndex; var sourceResults = this.searchResults[dataSourceIndex]; var dataIndex = 0; for (var i = 0, len = sourceResults.length; i < len; i++) { if (jimuUtils.isEqual(sourceResults, result)) { dataIndex = i; break; } } query('li', this.searchResultsNode) .forEach(lang.hitch(this, function(li) { html.removeClass(li, 'result-item-selected'); var title = html.getAttr(li, 'title'); var dIdx = html.getAttr(li, 'data-index'); var dsIndex = html.getAttr(li, 'data-source-index'); if (title === result.name && dIdx === dataIndex.toString() && dsIndex === dataSourceIndex.toString()) { html.addClass(li, 'result-item-selected'); } })); // Once we have the "mapPoint" object we convert it to a "screenPoint" object setTimeout(lang.hitch(this, function(){ var mpPt = result.feature.geometry; var scrPt = this.map.toScreen(mpPt); this.map.emit("click", { bubbles: true, cancelable: true, screenPoint: scrPt, mapPoint: mpPt }); }), 500); },
Cool, that's pretty slick. I do have some feature layers in the search box as well, whenever i use those to search it seems to cancel out the popup. Anyway to isolate those searches?
I assume the "show pop up for found feature" is interfering?
Leo,
Correct, I turned off "show pop up for found feature" when testing this.
did you happen to try it with a feature or dynamic layer in the search box?
Leo,
I did not.
do you happen to have a quick example of that?
thanks!