Passing Parameter to Flex Viewer

16997
114
01-14-2011 03:46 AM
CurtNielsen
New Contributor III
I would like to pass a parameter, parcel id, to flex viewer and have the map pan to that location. I have modified the Search widget to use a layer that we can search by parcel ID. Just want the same capability if I pass a parameter, paracle ID, to http://mynode/FlexViewer. Maybe something like http://mynode/FlexViewer?request=widget&version=2.1&WidgetName=Search&ParcelID=1234

Thank you!
Tags (2)
0 Kudos
114 Replies
MarcWeinshenker1
Occasional Contributor
I've been looking at this because I also want to be able to pass a parcel ID to open a map viewer to the associated parcel, but all the code in the previous discussions pertain to the SFV.  How can this be applied to the v2.2 Flex Viewer?

Thanks,
Marc
0 Kudos
SteveWhitehead__GISP
New Contributor III
Hi Marc, I am looking to do the same thing.  Did you have any luck with 2.2?
0 Kudos
MarcWeinshenker1
Occasional Contributor
Hi Marc, I am looking to do the same thing.  Did you have any luck with 2.2?


Steve,

I've been working on other things while waiting for any reply.  Nothing yet.  Today I'm trying to apply what appears to be the simplest solution, one posted by Rick Diaz for the 1.3 sample viewer in this thread: http://forums.esri.com/thread.asp?c=158&f=2421&t=266031&mc=47  It only requires modifying MapManager.mxml (I'm leaving out the progress bar for now). 

The main challenge I'm having is looking at the compile errors to figure out what needs to be modified to catch up to the API changes.  I really don't know what to expect in terms of functionality if and when I do get that all figured out.  Plus, I'm no developer so I'm totally winging it here.  If I get something work, I'll post it, but I'm still hoping a more skilled person will beat me to it.

Marc
0 Kudos
JonFisher
New Contributor III
Has anyone successfully been able to pass bounding coordinates to the 2.2 Flex Viewer in a URL? It looks like Jason never got it working in SFV 1.3 in http://forums.esri.com/thread.asp?c=158&f=2421&t=266031&mc=47#818760

I want to be able to have a URL to jump to each feature within my map. Since the size varies considerably from feature to feature, I think it will be easier to use bounding coordinates than center and scale (since I can easily calculate bounding coordinates using Field Calculator, and the map will jump to the nearest scale).

I have a vague memory that ESRI was considering enabling this for the 2.3 release, is that true?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jon,

   Sure here is the code to change in the MapManager.mxml

            //map load complete
            private function mapLoadComplete(event:MapEvent):void
            {
//My Add
    map.zoomSliderVisible = false;
    map.logoVisible = false;
    
    try
    {
     if (ExternalInterface.available)
     {
      var timer:Timer;
      var result:URLVariables = new URLVariables();
      var urlSubstring:String = ExternalInterface.call("window.location.search.substring", 1);    
      if (urlSubstring && urlSubstring.length > 0 && urlSubstring != "debug=true")
      {
       result.decode(urlSubstring);
       // Parse URL
       var xExt:String;
       var xUrlParam:String;
       if (result["EXT"])
        xExt = result.EXT;
       
       if (!xExt == ""){
        var extArray:Array = xExt.split(",");
        var extent:Extent = new Extent(Number(extArray[0]), Number(extArray[1]), Number(extArray[2]), Number(extArray[3]),map.spatialReference);
        map.extent = extent;
       }
      }
     }
    }
    catch (error:Error){}
//End My Add
            }


to use it just append something like:  ?EXT=644988.5757,1173575.0875,645690.0041,1173863.1558 to the url.
0 Kudos
JonFisher
New Contributor III
Thanks Robert, that worked perfectly! I was also happy to see that something similar is natively supported with the ArcGIS.com web map:http://www.arcgis.com/home/webmap/viewer.html?url=http://maps.tnc.org/ecadpubprodanon/rest/services/...

It seems like several people have been interested in this topic so I'm going to update some other threads to point to your solution here.
0 Kudos
MarcWeinshenker1
Occasional Contributor
Hi Marc, I am looking to do the same thing.  Did you have any luck with 2.2?


Steve,

I've successfully modified the code to pass a parcel ID in the URL.  The map opens and zooms to the parcel which has been overlaid by a graphic. I'm attaching a text file with explanations and code.

Marc
0 Kudos
SteveWhitehead__GISP
New Contributor III
Steve,

I've successfully modified the code to pass a parcel ID in the URL.  The map opens and zooms to the parcel which has been overlaid by a graphic. I'm attaching a text file with explanations and code.

Marc


Thank you very much Marc.  I will give it a go.
0 Kudos