Hi There, I am trying to do a query and check for a geometry that is not null, what is the best way to do this check. I tried to use x property and see if I could filter out value with Nan but this doesnt work.
Appreciate any feedback.
Thanks
Jay
shSrcLayer.queryFeatures(query, function (fs) { shSrcGLFS = fs; if (shSrcGLFS.features.length > 0) { shSrcGLgeom = shSrcGLFS.features[0].geometry; //alert("shSrcGLgeom: " + shSrcGLgeom.x + "," + shSrcGLgeom.y); } }); var mp = new Multipoint(new SpatialReference({ wkid: 3857 })); if (shSrcGLgeom .x !== 'NaN') { mp.addPoint(shSrcGLgeom ); }
See if isNan() javascript function works for you.
if (!isNaN(shSrcGLgeom.x)) {
//add point
}
I am using ExtJS API in my code. I am using Ext.isNumber() to check whether it's a number value.