Select to view content in your preferred language

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

4789
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
1 Solution

Accepted Solutions
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);                 }             }

View solution in original post

0 Kudos
20 Replies
RobertScheitlin__GISP
MVP Emeritus
James,

   First things first. You should post all Flex Viewer and/or Widget Questions to the Flex Viewer Forum here:

http://forums.arcgis.com/forums/111-ArcGIS-Viewer-for-Flex

What you are asking is doable but will require a lot of custom code do you have any experience customizing widgets in Flex?
0 Kudos
JamesHolley
Emerging Contributor
Robert,

I do have some experience customizing widgets but not a lot. I am learning as I go.  If you could provide any help or a starting point that would be great.

Thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
James,

   This is going to be a little complicated and you will have to add code in both widgets (the locate and the Identify widget). Are you using the standard otb (out of the box) locate widget? Are you going to have your Identify widget preloaded?
0 Kudos
MLowry
by
Frequent Contributor
I have used Robert's code and developed a widget that accepts address or lat/long or they click a point on the map, and then they input buffer parameters, and it sends they buffer to the search widget and then to a datagrid. Is this similar to what you're trying to do?
0 Kudos
JamesHolley
Emerging Contributor
Robert,

The Locate widget I am currently using is modified slightly to work with our current projection, but other than that it is standard. I will have the Identify widget preloaded.

Thanks again
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
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
JamesHolley
Emerging Contributor
Robert,

Thank you for taking the time to help me with this project.  I will try to make these changes today and let you know how it goes. 

Thanks again
0 Kudos
JamesHolley
Emerging Contributor
Robert,

I tested the .mxml an it returned these errors. Do you have any advice on how to fix these? Any help would be great.

Identify.mxml
Error 1061: Call to a possibly undefined method addListener through a reference with static type Class.

AppEvent.addListener(AppEvent.DATA_PUBLISH, sharedDataUpdated); Line 318

AppEvent.addListener(AppEvent.DATA_NEW_PUBLISHED, sharedDataUpdated2); line 323

Error 1137: Incorrect number of arguments.  Expected no more than 4. 

setMapAction(DrawTool.MAPPOINT, status, identMarkerSymbol, drawEnd, false); line 418

PopUpRendererSkin.mxml

Error 1180: Call to a possibly undefined method PopUpText. PopUpRendererSkin.mxml line 139 and 168


Thanks Again,
James
0 Kudos
JamesHolley
Emerging Contributor
Robert

I got it to work, thanks for all the help.

James
0 Kudos