Select to view content in your preferred language

Locate Widget Activate Layer Popup

2046
3
01-13-2014 07:03 AM
BrianO_keefe
Honored Contributor
Alright...
My webmap has a single layer, City Council Districts. That layer has a popup that displays 3 pieces of data from the layer source (Council District Number, Councilor Name, and an URL to link to the Council website for that Council District). I would like the Locate Widget to activate that popup instead of the usual returned window.

Desired workflow is as follows:


  1. User opens map

  2. Locate Widget pops up

  3. User enters their address

  4. The Locate widget locates their address and drops the LOCATE red dot on top of address

  5. AND activate the pop up from the underlying layer

I should add that I have Flash/Flex experience from about 6 years ago, I've spent the interim studying and working in GIS so my ActionScript / Flex dev skills are 'rusty.' Any help would be appreciated...
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Brian,

   When you say webmap do you mean a map on ArcGIS.com portal that you have configured the viewer to view using the itemid?

Here is the sample for displaying popups programmatically.

https://developers.arcgis.com/en/flex/sample-code/display-popups-programmatically.htm
0 Kudos
BrianO_keefe
Honored Contributor
We're running ArcGIS Server with Flexmaps.

I'm trying to get my hands dirty with flex again and customize a widget (or create one if I have to) that will let the user type in their address, drop a dot on that address, and simultaneously popup with the Council District underneath that dot.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Brain,

   In the LocateWidget.mxml you will find the showLocation function. It would need to be modified to look something like this (this is not complete, ready to use code)

            private function showLocation(data:Object):void
            {
                hideInfoWindow();
                graphicsLayer.clear();

                var ptGraphic:Graphic = new Graphic();
                ptGraphic.geometry = data.point;
                graphicsLayer.add(ptGraphic);
                
                var contentNavigator:ContentNavigator = new ContentNavigator();
                //
        //Here is where you need to use a querytask to get the layers graphic that you want the popup to appear for
        // then after the async result from the query returns.
        // then you set that graphic in the contentNavigator.dataProvider
        //
                contentNavigator.dataProvider = new ArrayList([ resultGraphic ]);
                // Put the ContentNavigator in the info window.
                map.infoWindowContent = contentNavigator;
                if (map.scale > zoomScale)
                {
                    map.scale = zoomScale;
                }
                map.centerAt(data.point);
                map.infoWindow.show(ptGraphic);
            }
0 Kudos