AnsweredAssumed Answered

Error in putting point from query on map view in 4.3

Question asked by gilbertgis on Jun 12, 2017
Latest reply on Jun 13, 2017 by mattprice

Hi all,

I wrote some javascript code to query a point based on input values, and zoom to the location and put a point graphic on the map.  The zoom and scale work fine, the query works good, but it will not draw the point on the map.  In fact , when I call the function putFeaturePointOnMap the scale and goTo functions don't run, so nothing happens.  If I comment out the function call, everything works OK. The alert and console.log statements fire when I run this, so I know that it's going to the function, and the console.log returns the x value of the point, so I know it's not undefined.  I've tried passing the feature itself, and the feature geometry, with no luck.

Thanks in advance to anyone who can answer this, I've triple checked everything and cannot understand why this will not work.



function queryAddress() {
  var aVal=document.getElementById("addrNumText").value;
  aVal+=" " + document.getElementById("stDirCbo").value;
  aVal+=" " + document.getElementById("streetCbo").value;
  query.where= "FULLADDR='" + aVal + "'";
  queryTask.execute(query).then(function(results) {
    var pPt = results.features[0];
    putFeaturePointOnMap(pPt.geometry);  //I've also tried just passing in pPt
function putFeaturePointOnMap(inPt) {
  console.log("point=" + inPt.x);
  var smsMarker = new SimpleMarkerSymbol({
    color: [0,255,0],
    size: 12
  var ptGraphic = new Graphic({
    geometry: inPt,
    symbol: smsMarker