AnsweredAssumed Answered

Zoom to Passed URL Code Help

Question asked by adevine on Mar 7, 2012
Latest reply on Jul 8, 2013 by kenbuja
Morning Folks,

I am currently redeveloping the campus web application for my university and wanted to reprogram an old functionality back in. When our campus map was ArcIMS-based, our registrar's office was apple to pass building number parameters via url to the map service from the campus class registration site and have the web app open zoomed to the building number passed. When we moved out map from ArcIMS to .Net Web ADF, I eliminated that functionality when I discovered that adding that functionality to the web app at that point was beyond my coding capability. A few years later now, and I have become a better coder. I am redeveloping the web app in javascript API and would like to allow the registrar's office to link and zoom to our web map again.

I believe I know how I could accomplish this, but I wanted to ask you more experienced folks if this seems the most efficient way: I already have a find, create graphics from results and zoom to envelope of graphics set of functions in my web app and was hoping to just utilize that. Here is the code:

function execute(searchText) {          //set the search text to find parameters          findParams.searchText = searchText;          findTask.execute(findParams, showResults);     }          function showResults(results) {        //display the results of the building text search          //symbology for graphics          var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 255, 255]), 1), new dojo.Color([0, 255, 255, 0.25]));          var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([0, 255, 255]), 1);          var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([0, 255, 255]), 2), new dojo.Color([0, 255, 255, 0.25]));            //find results return an array of graphics in the graphicslayer.          var graphicslayer = new esri.layers.GraphicsLayer();        ;           //Build an array of attribute information and add each found graphic to the map           dojo.forEach(results, function(result) {             var graphic = new esri.Graphic(result.feature);             graphic.setSymbol(polygonSymbol);   ;              graphicslayer.add(graphic);                                    });            //create an extent matching the graphics of the parcel(s)          var zoomExtent = esri.graphicsExtent(;    var zoomXmin = zoomExtent.xmin;    var zoomXmax = zoomExtent.xmax;    var zoomScale = zoomXmax - zoomXmin;    if (zoomExtent.xmin < 2508000 || zoomExtent.ymin < 1420000 || zoomExtent.xmax > 2567000 || zoomExtent.ymax > 1453000)                  {     alert("Your Find Building results include a building outside of ACC/Main UGA Campus. Please refine your search");     }    else if (zoomScale > 10000)     {      alert("Your Find Building results require a coarse scale to display. Please refine your search");      }    else     {     map.setExtent(zoomExtent.expand(2));     }         } 

I was thinking that I could get the registrar's office to change their software to generate a url appended with ?NUMBER=#### and I could write a function to parse the code, extract the value for number and pass that to the above existing function and have it handle the task. Would this be the most efficient way to accomplish this? I would probably use an if statement in the "init" function to look for a url with the appended info and then just make it jump to the function execute(searchText). Does that sound reasonable? Anyone have a better solution? Thank you in advance for your help.

Alex DeVine
University of Georgia