Hi all,Just been looking at the network traffic and it seems the zoom is failing because the following request is being generated from my code:http://<server>/ArcGIS/rest/services/SLR/CadastreRoad/MapServer/0/query?f=json&returnGeometry=true&spatialRel=esriSpatialRelIntersects&objectIds=2401863&outFields=PLANNUMBER%2CLOTNUMBER%2COBJECTID%2CSECTIONNUMBER%2CclassSubtype&outSR=102113&callback=dojo.io.script.jsonp_dojoIoScript10._jsonpCallbackThe problem is that %2classSubtype is being added to the end of the request for some reason. Does anyone know why this is happening?? Where is that coming from? Thanks for the help.Ed
Hi all,This is probably an easy one but I can't figure it out...I'm sending query tasks results to a graphics layers with attributes. I'm also populating a DataGrid with the results and then trying to zoom to a record when the user clicks on a row. Except the zoom function doesn't work and I get the following error:'graphic.attributes is undefined' at the following line in the zoomRow function:if (graphic.attributes.OBJECTID.toString() === id) { It seems that when the zoom function tries to access the graphics layer attributes, it can't find OBJECTID. Below is the code for the query task. Any help is VERY much appreciated!Thanks,Edfunction executeTask() { var planNumber = dijit.byId('planNumber').value; var lotNumber = dijit.byId('lotNumber').value; var queryTask = new esri.tasks.QueryTask("http://<server>/ArcGIS/rest/services/SLR/CadastreRoad/MapServer/0"); var query = new esri.tasks.Query(); query.returnGeometry=true; query.outFields = ["PLANNUMBER","LOTNUMBER","OBJECTID","SECTIONNUMBER"]; query.where = "PLANNUMBER='" + planNumber + "' AND LOTNUMBER='" + lotNumber + "'"; dojo.connect(queryTask,"onComplete", function(featureSet) { //build an array of attributes var items = dojo.map(featureSet.features, function(feature) { return feature.attributes; }); var data = { identifier:"OBJECTID", items:items }; store = new dojo.data.ItemFileReadStore({ data:data }); grid.setStore(store); grid.setSortIndex(1,"true"); //sort on the state name dojo.forEach (featureSet.features, function(feature) { map.graphics.add(feature); }); }); queryTask.execute(query);}function makeZoomButton(id) { var zBtn = "<div dojoType='dijit.form.Button'><img src='images/zoom.png'"; zBtn = zBtn + " width='18' height='18'"; zBtn = zBtn + " onClick=\"zoomRow('"+id+"')\"></div>"; return zBtn;}function zoomRow(id) { selectionLayer.clear(); dojo.some(map.graphics.graphics, function(graphic) { if (graphic.attributes.OBJECTID.toString() === id) { var selectedState = new esri.Graphic(graphic.geometry).setAttributes( graphic.attributes); selectionLayer.add(selectedState); var stateExtent = selectedState.geometry.getExtent().expand(5.0); map.setExtent(stateExtent); return true; } });}
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.