First let me say that I am totally new to the Esri Web AppBuilder world and widgets but I find it fascinating and I am looking forward to learning more. Please forgive me for any awkward phrasing or incorrect terminology.
Let me also say that I am very impressed with Robert Scheitlin, GISP and his awesome Widgets. I am especially very keen on his Identify Widget. I am hoping to be able to make a few modifications that will help make it a very useful tool for me.
I hope to use the widget by being able to select a point on the map and having the widget display all of the Administrative Polygons the point is contained in. The polygons are simple: State, County, Township, City, Village, etc.. And the widget does exactly that out of the box.
That said, here are a few questions which I hope some kind developer's could assist me with:
I would really appreciate any help or any links which might help me understand what I am doing wrong (#1) or how I might be able to implement (#'s 2 and 3).
Thanks
Solved! Go to Solution.
Larry,
Robert,
Thanks for personally responding to my questions. That was an unexpected surprise.
1) I understand what you're saying. I have seen other examples of your widget in use with projects containing a large number of layers. In my case, I have only about 10 different polygon layers. The results come back almost instantaneously which was the reason I asked if I was doing something wrong. I'm sure if I had 100 or more layers, the response would not be so quick. It would be nice if it was perhaps an option for users like me (if there were any) who would prefer to have the results follow the Layer Names in the Configuration.
2) Yes. For me, I could see the centroid lat lon for other geometry types as being helpful and the actual lat lon for where the identified point was placed.
3) I was a little hopeful that this might be something that could be done but I wasn't sure how the data was being handled/processed before displaying them into the Results tab. I'm a simple guy and that doesn't always equate to the sophisticated coding that I see in other works. I thought it might be easy to concatenate each Layer's Name, Alias, and Value to a string while writing it out to the Results display. Then the string could be copied to the clipboard or something like that. But then I don't know enough to about JS right now to know if that could be done. Only enough to be dangerous.
Thanks again for taking the time to respond. At least I have a little better understanding of your widget. It is still pretty cool!
Larry
Larry,
For number 2 here is some code to change in the Widget.js IdentifyFeatures function. Add lines 10 - 26.
identifyFeatures: function(geom){
this.numServicesIdent = 0;
this.identifyResultsArray = [];
this.iResultLen = 0;
this.resultFound = false;
this.list.clear();
this.tabContainer.selectTab(this.nls.resultslabel);
html.setStyle(this.progressBar.domNode, 'display', 'block');
html.setStyle(this.divResult, 'display', 'none');
if(geom.type === 'point'){
var idResult = {};
var rsltContent = '';
idResult.icon = this.folderUrl + 'images/i_info.png';
idResult.title = "User Selected Point";
var value = this._formatNumber(geom.getLongitude(), 4, null, null) + ", " + this._formatNumber(geom.getLatitude(), 4, null, null);
rsltContent = this.resultFormatString.replace('[attribname]', 'Longitude-Latitude').replace('[attribvalue]', value);
if(rsltContent.lastIndexOf('<br>') === (rsltContent.length - 4)){
idResult.rsltcontent = rsltContent.substr(0, rsltContent.length - 4);
}else{
idResult.rsltcontent = rsltContent;
}
idResult.zoom2msg = '';
idResult.removeResultMsg = '';
idResult.sym = this.resultSym;
this.list.add(idResult);
}
...
Wow! That was slick! Thank you, Mr. Scheitlin!
larry
Hi Robert,
I think I would like to place a symbol at the User Selected Point (Red Stick Pin). Would this block of code be the appropriate place to accomplish that or would you recommend someplace else with the widget.js?
larry
Larry,
It would be the appropriate location. You would need to add the graphic to the GL.
this.graphicsLayer.add(iGra);
and add the graphic to the idResult
idResult.graphic = iGra;
Hi Robert,
I have been playing around with this all day but something is either wrong or I am to much of a newbie to understand what is happening. I added the two lines of code within the block of code.
And the best result I can get is this:
I get the StickPin marker and I get the Lon-Lat values. No other data displays. And the progress bar at the top just continually grinds. It almost seems that the two lines of code are stepping on the rest of the attributes being processed.
I'm really overlooking something simple, right?
larry
Larry,
What error(s) are shown in the browsers console?
Checking it out now.