IdentifyParameters fail

3745
4
09-17-2014 09:24 AM
NadirHussain
Occasional Contributor II

identifyParams.tolerance = 3;

                            identifyParams.returnGeometry = true;

                            identifyParams.layerIds = [0, 1, 2, 3, 4, 5];

                           identifyParams.geometry = point;

                            identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;

                            identifyParams.width = map.width;

 

 

 

the redline fail.It give the message.cannot read property 'geometry' undefined  .

 

please what should be the reason.Thanks in advance.

0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor

In your code, "point" is a variable. How have you created it?

This is how it's done in a sample

map.on("click", doIdentify);

function doIdentify (event) {
            map.graphics.clear();
            identifyParams.geometry = event.mapPoint;
            identifyParams.mapExtent = map.extent;
            identifyTask.execute(identifyParams, function (idResults) {
              addToMap(idResults, event);
            });
          }


0 Kudos
NadirHussain
Occasional Contributor II

function myClickHandler(evt) {

                try {

                    map.graphics.clear();

                    if (identfyFlag == 1) {

                        var point = evt.mapPoint;

                        SMS.setStyle(SimpleMarkerSymbol.STYLE_CIRCLE);

                        SMS.setSize(12);

                        SMS.setColor(new esri.Color([255, 0, 0, 0.5]));

                        identifyTask = new IdentifyTask("http://dell-pc/ArcGIS/rest/services/Sirens/MapServer");

                        identifyParams = new IdentifyParameters();

                        identifyParams.tolerance = 3;

                        identifyParams.returnGeometry = true;

                        identifyParams.layerIds = [0, 1, 2, 3, 4, 5];

                        if (identifyParams != null) {

                                   identifyParams.Geometry = point;

                                  identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;

                                  identifyParams.width = map.width;

                                  identifyParams.height = map.height;

                        }

                      

                   

                        var pointGraphic = new Graphic(point, SMS);

                        map.graphics.add(pointGraphic);

                     

                        idResults = new IdentifyResult();

                        processIdentifyResults(point)

                    }

                } //try

                catch (err) {

                    txt = "There was an error on this page.\n\n";

                    txt += "Error description: " + err.message + "\n\n";

                    txt += "Click OK to continue.\n\n";

                    alert(txt);

                }

            }

Dear ken thanks for reply. my complete code is above.i passed the event mapPoint to the point variable.

0 Kudos
KenBuja
MVP Esteemed Contributor

Remember that Javascript is case sensitive. The line

identifyParams.Geometry = point;

should be

identifyParams.geometry = point;

Why are you using this if statement?

if (identifyParams != null) {

The way your code is written, this will always be true

0 Kudos
NadirHussain
Occasional Contributor II

function myClickHandler(evt) {

                try {

                    map.graphics.clear();

                    if (identfyFlag == 1) {

                        var point = evt.mapPoint;

                        SMS.setStyle(SimpleMarkerSymbol.STYLE_CIRCLE);

                        SMS.setSize(12);

                        SMS.setColor(new esri.Color([255, 0, 0, 0.5]));

                        identifyTask = new IdentifyTask("http://dell-pc/ArcGIS/rest/services/Sirens/MapServer");

                        identifyParams = new IdentifyParameters();

                        identifyParams.tolerance = 3;

                        identifyParams.returnGeometry = true;

                        identifyParams.layerIds = [0, 1, 2, 3, 4, 5];

                        identifyParams.geometry = point;

                        identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;

                         identifyParams.width = map.width;

                         identifyParams.height = map.height;

                          var pointGraphic = new Graphic(point, SMS);

                         map.graphics.add(pointGraphic);

                          idResults = new IdentifyResult();

                         processIdentifyResults(point)

                    }//if

                } //try

                catch (err) {

                    txt = "There was an error on this page.\n\n";

                    txt += "Error description: " + err.message + "\n\n";

                    txt += "Click OK to continue.\n\n";

                    alert(txt);

                }

            }

dear ken,

i update the code.but same error is coming.i am confused.please help

0 Kudos