Identify Widget - Point Selection Issue

1694
20
Jump to solution
10-03-2019 06:51 AM
JasonStanton__GISP
Occasional Contributor

Robert,

I am using the Identify widget in WAB DE 2.13.  I am using the point selection tool to select points.  Some times it works, some times it doesn't, and most oddly - sometimes it selects a point up to 100 feet away.  The data, data frame/service and basemap are all WKID 10200.  I have tried to play with the Identify Tolerance to no avail.  Any ideas what might be happening here?


Jason

0 Kudos
20 Replies
JasonStanton__GISP
Occasional Contributor

link removed

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

  I am testing now. One thing I have noticed is that you have several duplicate points in your data.

0 Kudos
JasonStanton__GISP
Occasional Contributor

That's really odd... can you shoot me a couple lot id's so I can check?  There shouldn't be any duplicates.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

V-1-1 has OID 3138 and 2476
V-1-2 has OID 2134 and 2662

0 Kudos
JasonStanton__GISP
Occasional Contributor

Thanks, I never noticed that.  I was always working on the other cemetery while testing

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

   These two functions have to updated in the Widget.js.

      createQueryParams: function (layers, geom) {
        var queryParamsList = [];
        array.forEach(layers, lang.hitch(this, function (layer) {
          var queryParams = new Query();
          queryParams.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
          if(geom.type === 'point'){
            geom = this.pointToExtent(geom , this.identifytolerance);
            if (layer.geometryType === 'esriGeometryPoint') {
              queryParams.spatialRelationship = Query.SPATIAL_REL_CONTAINS;
            }
          }
          queryParams.geometry = geom;
          queryParams.outFields = ['*'];
          queryParams.returnGeometry = this.returngeometryforzoom;
          queryParams.outSpatialReference = this.map.spatialReference;
          queryParamsList.push(queryParams);
        }));
        return queryParamsList;
      },

      pointToExtent: function(objPoint, distance){
        var clickOffset = distance || 6;
        var scrnPnt = this.map.toScreen(objPoint);
        scrnPnt.update(scrnPnt.x + clickOffset, scrnPnt.y + clickOffset);
        var nPnt = this.map.toMap(scrnPnt);
        var queryExtent = new Extent(
          Math.min(objPoint.x, nPnt.x),
          Math.min(objPoint.y, nPnt.y),
          Math.max(objPoint.x, nPnt.x),
          Math.max(objPoint.y, nPnt.y),
          objPoint.spatialReference);
        return queryExtent.centerAt(objPoint);
      },

and find this line in the Widget.js and delete the "+"

this.iResultLen += this.list.items.length;

so it looks like this:

this.iResultLen = this.list.items.length;

I will be releasing a 2.13 version soon that has these changes.

0 Kudos
JasonStanton__GISP
Occasional Contributor

THANK YOU!!

0 Kudos
DrewPhillips3
New Contributor II

I'm having the same issue. (Robert, you may remember me from elsewhere; I though I'd take a crack at customizing the Identify widget which works amazingly).

The point select options works perfectly if "Return Geometry for Zoom" is true. But this makes Identifying other layers slow, as all geometries must be returned.

Is it possible that the info returned from the point selection option MUST include its geometry, the way that it is programmed? I'm thinking that removing the geometry return makes the selection fail but only for point selections. Maybe I could return geometry for the point only as a semi-workaround.

Thanks!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Drew,

   Yes there is an bug in the code when using the point tool and return geometry is false. Here is the code fix for that.

I will include this in the 2.14 release of this widget.

This code goes in the Widget.js showIdentifyResults function starting at line 1315 in the 2.13 version of code.

idResult.point = (this.returngeometryforzoom) ? this.getGeomCenter(identifyResult.feature.geometry) : this.getGeomCenter(this.identifyGeom);
idResult.geometry = (this.returngeometryforzoom) ? identifyResult.feature.geometry : this.identifyGeom;

The old block of code looked like this:

            if(this.identifyGeom.type === 'point' && identifyResult.feature.geometry.type === 'point'){
              idResult.point = idResult.geometry = (this.returngeometryforzoom ) ? identifyResult.feature.geometry : this.identifyGeom;
            }else{
              idResult.point = (this.returngeometryforzoom) ? this.getGeomCenter(identifyResult.feature.geometry) : this.getGeomCenter(this.identifyGeom);
              idResult.geometry = (this.returngeometryforzoom) ? identifyResult.feature.geometry : this.identifyGeom;
            }‍‍‍‍‍‍‍‍‍‍‍‍

Thanks for the heads up on this.

0 Kudos
DrewPhillips3
New Contributor II

Thanks for the response. Should I replace the entire "old block" in the widget code with the 2 lines above - remove the entire if/else conditional? Or change the code in the else block?

0 Kudos