Popup for ArcGISDynamicMapServiceLayer point data

1448
1
12-23-2013 12:08 AM
ManojrajTeli
Occasional Contributor II
Hello,


I was going through this example from ESRI Resource
PopUp

I was able to integrate it to my polygon layer but it is failing for point and line layer.I am not sure but
query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;

could be the reason.I tried the other combination of the task but was not successful if anyone has another example or if anyone could suggest something in existing example then it will be very helpful.

Thanks
Manojraj Teli
1 Reply
JakeSkinner
Esri Esteemed Contributor
Hi Manojraj,

What I usually do is create a polygon from the map click.  Ex:

query.geometry = pointToPolygon(map, evt.mapPoint.x, evt.mapPoint.y, 200);

function pointToPolygon(map, pointX, pointY, tolerance){
        var xmin = pointX - tolerance;
        var ymin = pointY - tolerance;
        var xmax = pointX + tolerance;
        var ymax = pointY + tolerance;
    
        var extent = new Extent(xmin, ymin, xmax, ymax, map.spatialReference)
        
        var polygon = new Polygon(new SpatialReference({wkid:102100}));
        polygon.addRing([[extent.xmin, extent.ymin], [extent.xmin, extent.ymax], [extent.xmax, extent.ymax], [extent.xmax, extent.ymin]]);
        return polygon
}   
0 Kudos