Select to view content in your preferred language

Using the Locate Widgets results, to populate the datagrid in the Identify Widget

4793
20
Jump to solution
01-17-2012 08:18 AM
JamesHolley
Emerging Contributor
I would like to pass the x,y map point generated when a user searches for their address to populate the identify widget's datagrid with information such as parcel, zoning, and land Use.  I am currently using flex api 2.3.1

Any help would be great.
Tags (2)
0 Kudos
20 Replies
RobertScheitlin__GISP
MVP Emeritus
James,

   Great you must have figured out that I programed it for Flex Viewer 2.5 (forgot you said you where using 2.3.1).

Don't forget to click the Mark as answer check as shown below:
0 Kudos
MarcWeinshenker1
Regular Contributor
Robert,

This is very cool.  I've been wanting this kind of function for a long time.  I'm having trouble getting it working, though, and I think part of the problem is that I only allow Identify by a point.  I made attempt to modify your code to set a point rather than create a polygon extent but it was overreaching the limits of my abilities.  Setting the tolerance in the existing code to a small fraction wasn't a great solution, either.  Any chance you could offer a point version for this function?

Thanks very much,
Marc

EDIT:  in looking at this a bit more, I was able to get it to work with a low tolerance (0.1) but there are some behavior issues in the interaction between the Identify and Locate widgets.  In particular, any new results from Identify or from the Locator just keep adding on.  Clearing out previously acquired data is not handled well.  Any chance you'd like to work on this more?  It's a great function.

EDIT 2:  I just found another issue.  If I use the Locator first and then open Identify, it hangs up at "Loading..." after clicking on the tool, e.g., point identify.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Marc,

   This is more of a proof of concept that a full production ready code set that I am going to support. For issue 2 you can see that I asked James if he would have the identify widget preloaded and that is what the programing was for.
0 Kudos
MarcWeinshenker1
Regular Contributor
Ok, thanks.
0 Kudos
JamesHolley
Emerging Contributor
Robert,

Got everything up and running well, but ran into one issue. I would like to clear the identify widget's dataresults on each new address search or graphics selection. Instead of just adding to the existing results. 

Thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
James,

   Just add this one line in the code below:

            private function sharedDataUpdated2(event:AppEvent):void             {                 var dataTable:Hashtable = event.data.data as Hashtable;                 if (dataTable.containsKey("Find U.S. address"))                 {                     var recAC:ArrayCollection = dataTable.find("Find U.S. address") as ArrayCollection;                                          var locateResult:* = recAC[0];                     var mPoly:Polygon = new Polygon(null);                     // The tollerance of 12 is all dependant on how big of a right of way there                     // is from the road                     var ext2:Extent = createExtentAroundMapPoint(locateResult.point, 12) as Extent;                     var pA2:Array = [];                     pA2.push(new MapPoint(ext2.xmin,ext2.ymin,ext2.spatialReference));                     pA2.push(new MapPoint(ext2.xmin,ext2.ymax,ext2.spatialReference));                     pA2.push(new MapPoint(ext2.xmax,ext2.ymax,ext2.spatialReference));                     pA2.push(new MapPoint(ext2.xmax,ext2.ymin,ext2.spatialReference));                     pA2.push(new MapPoint(ext2.xmin,ext2.ymin,ext2.spatialReference));                     mPoly.addRing(pA2);                     mPoly.spatialReference = ext2.spatialReference;                     clear();                     identifyFeatures(mPoly);                 }             }
0 Kudos
JamesHolley
Emerging Contributor
Thanks, knew it was simple, just didn't know where to add it to the code.
0 Kudos
DanielMunoz
Regular Contributor
This is a great combination of tools! Thank you for posting it.
The problem I'm facing is when it is set to a low number (0.1) works great when the user is zoomed out at the County level once the address is found and zooms to street level, the locate-identify does not work any longer because the tolerance is to low; if I set the value to higher number to work at street level then it returns 100's of records at county level.
I was wondering if you guys can give me some ideas how to make the tolerance value map extend independent, or may be something not so sophisticated like force a zoom to the map initialextent before next locate an address event.

Thank you!
0 Kudos
DanDowning
Regular Contributor
Robert,

Is there a version of this identify widget that is compiled for flexviewer 3.0?

Thanks,

Danny

James,

  So here it is, I ended up only having to add code to the Identify widget and I tried to comment all my changes. The big thing is this line needs to be the name of your locate widget:

if (dataTable.containsKey("Find U.S. address"))


What you are attempting to identify needs to be on and visible. Basically when you locate an address the XY map point is fired off to the identify widget and buffered 12 units in attempt to get far enough away from the street center line to pickup a parcel.

Don't forget to click the top arrow (promote) and to click the Mark as answer check as shown below:
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Danny,

   As I mentioned before above. This is more of a proof of concept that a full production ready code set that I am going to support. Thus No there is not a compiled version of this change for 3.0.
0 Kudos