AnsweredAssumed Answered

Features not found with query.geometry

Question asked by endlessdsire on Mar 23, 2016
Latest reply on Mar 23, 2016 by endlessdsire


Im trying to make a query with the map.onclick to get the features founded around the click.

I have added 2 featurelayers that have some values that i want to get when the user clicks to make another analysis.

The problem that now im having is that even if i make a polygon to search for any value, my featureSet doesnt give me any.


My code is:


function clickSearch(mapPoint){

  var rectangle = new esri.geometry.Polygon(new esri.SpatialReference(mapPoint.spatialReference.wkid));



  var queryTask = new esri.tasks.QueryTask(layers.read_layer_interr_sed());

  var query = new esri.tasks.Query;


  query.geometry = rectangulo;


  query.returnGeometry = true;


      console.log("found something here...what is it?");



      }else console.log("nothing");



    console.log("no encontre na" , error);




function createRectangle(mapPoint,delta){

    var arrayOfPoints = [];

  arrayOfPoints[0] = new esri.geometry.Point(mapPoint.x-delta,mapPoint.y-delta,mapPoint.spatialReference);

  arrayOfPoints[1] = new esri.geometry.Point(mapPoint.x-delta,mapPoint.y+delta,mapPoint.spatialReference);

  arrayOfPoints[2] = new esri.geometry.Point(mapPoint.x+delta,mapPoint.y+delta,mapPoint.spatialReference);

  arrayOfPoints[3] = new esri.geometry.Point(mapPoint.x+delta,mapPoint.y-delta,mapPoint.spatialReference);

  arrayOfPoints[4] = new esri.geometry.Point(mapPoint.x-delta,mapPoint.y-delta,mapPoint.spatialReference);


  return arrayOfPoints;




Im not using require to load the modules.

Im programming with ReactJS, webpack server and i just installed the api in that server.

I have been used all the elements for the api in this way:

Example for featureLayer.

var myDynamicSedLayer = new esri.layers.FeatureLayer(layers.read_layer_interr_sed(),{

       mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,

       infoTemplate: myinfotemplate.getSubFailure(),

       outFields: ["*"]



Anyone knows what could be happening? or any example doing this.

I already search about it in the sample api.


Thanks in advice.