Hi Marc, I am looking to do the same thing. Did you have any luck with 2.2?
//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 }
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
Hi Marc,That worked perfectly, thanks a lot.The only further customization I need is to switch the query from a "like" search to an exact search.Is this possible through the code or can you advise how to go about it via the MXD?Thanks a lot,brendan
Marc - Thank you for the code! I've tried modifying my MapManager.mxml and I keep getting the error "[RPC Fault faultString="Unexpected < encountered" faultcode="null" faultDetail="null"]I've tried different services/layers to query with no luck. Any ideas? Any help would be much appreciated!
Marc - I double checked the service and layer, and it's hitting the right one. Any other insight would be great!Thanks,Amber
Amber, Three questions. Is the error coming up during compile or run time? Did you add the set of import statements I listed to the MapManager.mxml? And, from the error saying it came across an unexpected < , did you do a text search on MapManager.mxml to see if there is a stray angle bracket?Marc
Marc and Amber,Marc, hope you don't mind I'm going to jump in and see if I can help.Amber, can you post your code for the mapLoadComplete function that you are attempting to use?
ViewerContainer.dispatchEvent(new AppEvent(AppEvent.LAYER_LOADED)); var urlSubstring:String = ExternalInterface.call("window.location.search.substring", 1); if (urlSubstring != ""){ // Parse URL var totalLength:Number = urlSubstring.length; var i:int = 0; var firstLetter:String = urlSubstring.charAt(i); var firstEqualsSignLocation:Number = urlSubstring.indexOf('='); var firstStarLocation:Number = urlSubstring.indexOf('*'); var firstExclamtionLocation:Number = urlSubstring.indexOf('!'); if (firstLetter == "q"){ // Parcel Query var label:String = "Processing query... please wait." var queryTask:QueryTask = new QueryTask(); var qGlyr:GraphicsLayer = new GraphicsLayer(); map.addLayer(qGlyr); var graphicLineSym:SimpleLineSymbol = new SimpleLineSymbol("solid", 0xFFFF00, 0.8, 2); // Yellow outline var graphicPolySym:SimpleFillSymbol = new SimpleFillSymbol("solid", 0xFF0000, 0.5, graphicLineSym); // Red fill var qValue:String = urlSubstring.substring( (firstEqualsSignLocation + 1),firstExclamtionLocation); var qValueLyr:String = urlSubstring.substring( (firstExclamtionLocation + 1),firstStarLocation); var vValue:String = urlSubstring.substring( (firstStarLocation + 3),totalLength); var qFCPre:String = "<theservername>/arcgis/rest/services/"; var qFCSuf:String = "/MapServer/"; var queryLayer:String = qFCPre + qValue + qFCSuf + qValueLyr; var query:Query = new Query(); query.returnGeometry = true; query.text = vValue; queryTask.url = queryLayer; queryTask.execute(query, new AsyncResponder(onResult, onFault)); function onResult(featureSet:FeatureSet, token:Object = null):void { qGlyr.clear(); // clear the graphics layer if (featureSet.features.length == 0) { Alert.show("No Parcels matched. Please try again."); } else { var unionExtent:Extent; var myFirstGraphic:Graphic = featureSet.features[0]; unionExtent = Polygon(myFirstGraphic.geometry).extent; for each (var myGraphic1:Graphic in featureSet.features){ myGraphic1.symbol = graphicPolySym; qGlyr.add(myGraphic1); unionExtent = unionExtent.union(Polygon(myGraphic1.geometry).extent); } map.extent = unionExtent; // Zoom to queried polygon } } function onFault(info:Object, token:Object = null):void { Alert.show(info.toString()); } } } // LCRA - URL Modification ends here
var qFCPre:String = "<theservername>/arcgis/rest/services/";
http://xyz.jacksongov.org/parcelviewer/index.cfm?q=ParcelsAndAddresses!6*v=69-710-15-07-00-0-00-000
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.