Joshua, There is not tolerance built in for the point graphical search so you have to add one on your own like this:private function searchDrawEnd(event:DrawEvent):void { event.target.deactivate(); var geom:Geometry = event.graphic.geometry; if(geom.type == Geometry.MAPPOINT) { //Expand the point by 5 pixels var point:MapPoint = geom as MapPoint; var xMin:Number = map.toScreen(point).x - 2.5; var yMin:Number = map.toScreen(point).y - 2.5; var xMax:Number = map.toScreen(point).x + 2.5; var yMax:Number = map.toScreen(point).y + 2.5; var mp1:MapPoint = map.toMap(new Point(xMin,yMin)); var mp2:MapPoint = map.toMap(new Point(xMax,yMax)); var ext:Extent = new Extent(mp1.x, mp1.y, mp2.x, mp2.y); var pA:Array = []; var pPoly:Polygon = new Polygon(null,geom.spatialReference); pA.push(new MapPoint(ext.xmin,ext.ymin,geom.spatialReference)); pA.push(new MapPoint(ext.xmin,ext.ymax,geom.spatialReference)); pA.push(new MapPoint(ext.xmax,ext.ymax,geom.spatialReference)); pA.push(new MapPoint(ext.xmax,ext.ymin,geom.spatialReference)); pA.push(new MapPoint(ext.xmin,ext.ymin,geom.spatialReference)); pPoly.addRing(pA); queryFeaturesGraphical(pPoly); } else { queryFeaturesGraphical(geom); } }
private function searchDrawEnd(event:DrawEvent):void { event.target.deactivate(); var geom:Geometry = event.graphic.geometry; if(geom.type == Geometry.MAPPOINT) { //Expand the point by 5 pixels var point:MapPoint = geom as MapPoint; var xMin:Number = map.toScreen(point).x - 2.5; var yMin:Number = map.toScreen(point).y - 2.5; var xMax:Number = map.toScreen(point).x + 2.5; var yMax:Number = map.toScreen(point).y + 2.5; var mp1:MapPoint = map.toMap(new Point(xMin,yMin)); var mp2:MapPoint = map.toMap(new Point(xMax,yMax)); var ext:Extent = new Extent(mp1.x, mp1.y, mp2.x, mp2.y); var pA:Array = []; var pPoly:Polygon = new Polygon(null,geom.spatialReference); pA.push(new MapPoint(ext.xmin,ext.ymin,geom.spatialReference)); pA.push(new MapPoint(ext.xmin,ext.ymax,geom.spatialReference)); pA.push(new MapPoint(ext.xmax,ext.ymax,geom.spatialReference)); pA.push(new MapPoint(ext.xmax,ext.ymin,geom.spatialReference)); pA.push(new MapPoint(ext.xmin,ext.ymin,geom.spatialReference)); pPoly.addRing(pA); queryFeaturesGraphical(pPoly); } else { queryFeaturesGraphical(geom); } }
var ext:Extent = new Extent(mp1.x, mp1.y, mp2.x, mp2.y);
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.