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(); map.graphics.clear(); //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); map.graphics.add(graphic); graphicslayer.add(graphic); }); //create an extent matching the graphics of the parcel(s) var zoomExtent = esri.graphicsExtent(graphicslayer.graphics); 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)); } }
Solved! Go to Solution.
function getBuildNoFromUrl(url) { var urlObject = esri.urlToObject(url); if (urlObject.query && urlObject.query.NUMBER) { return urlObject.query.NUMBER; } }
var url = window.location; var NUMBER = getBuildNoFromUrl(document.location.href); if (!!NUMBER){ searchText = NUMBER; execute(searchText); }
var zoomExtent = "extent=" + dojo.toJson(map.extent.toJson()); window.location = appUrl + "?" + zoomExtent;