on(dom.byId("mapshow"), "click", selectHistorical); function selectHistorical(){ var queryTask = new QueryTask(window.historicalUrl); var query = new Query(); query.returnGeometry=true; query.outFields=window.historicalOutFields; query.text = dom.byId("mydropdown").value; query.outSpatialReference = {"wkid":2236}; dojo.connect(queryTask, "onComplete", function(featureSet){ map.graphics.clear(); dojo.forEach(featureSet.features, function(feature){ var graphic = feature; map.graphics.add(graphic); }); }); queryTask.execute(query); }
Solved! Go to Solution.
function selectHistorical() { var queryTask = new QueryTask(window.historicalUrl); var query = new Query(); query.returnGeometry = true; query.outFields = window.historicalOutFields; query.where = "DeviceId = '" + dom.byId("mydropdown").value + "'"; query.outSpatialReference = { "wkid": 4326 }; dojo.connect(queryTask, "onComplete", function (featureSet) { map.graphics.clear(); dojo.forEach(featureSet.features, function (feature) { var point = new Point(feature.geometry.x, feature.geometry.y, new SpatialReference({wkid:4326})); var simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0,255,0,0.25]), 1), new Color([255,0,0]) ) var graphic = new Graphic(point, simpleMarkerSymbol); map.graphics.add(graphic); }); }); queryTask.execute(query); }
depending on how you code it might be in console or you can see the request being send and the reply in the net tab ie:
when you click the query button you should see the request and the response:
[ATTACH=CONFIG]32027[/ATTACH]
I personally always take the points and do a for loop and position all the points features.geometry using map.graphic.
Im at home at the moment but if you can see if you get the response and the data from that .value is what you expecting im sure i can help without my work laptop.
dojo.connect(queryTask, "onComplete", function (featureSet) { map.graphics.clear(); dojo.forEach(featureSet.features, function (feature) { var point = new Point(feature.geometry.x, feature.geometry.y, new SpatialReference({wkid:4326})); var simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0,255,0,0.25]), 1), new Color([255,0,0]) ) attr = {"Velocity": feature.attributes.Velocity}; var infoTemplate = new InfoTemplate("Attributes", "Velocity: ${Velocity}"); var graphic = new Graphic(point, simpleMarkerSymbol, attr, infoTemplate); map.graphics.add(graphic); featureArray = []; featureArray.push(graphic); map.infoWindow.setFeatures(featureArray); map.infoWindow.show(point); }); });