Select to view content in your preferred language

Finding Points within small distance

404
1
02-04-2011 11:14 AM
WilliamKimrey
Emerging Contributor
Hello folks,

I'm stumped on this one.  I'm uploading a text file that contains a list of XY coordinates.  I show these coordinates in a ListBox and create points based on these and add them to the graphics layer on my Silverlight 4 App.  Then, the user selects a feature layer to upload these new points to.  However, before the upload occurs, a check is performed that determines whether or not a point is within a couple of inches of an existing point.

If the new point is within this small distance, the graphic's symbol changes and the corresponding XY coordinates in the ListBox will highlight/change color.  The user then gets the option to remove the points that are flagged like this and afterwards, the points are added to the featurelayer.

The problem I'm having is determining whether or not the new points are within a few inches of existing points and then flagging them in someway that I can remove them from my original list.

I've tried using several methods involving the GeometryService, but have had very little luck.  Is there any kind of example or method that I'm not aware of that I can use?  Would I be better off making a geoprocessing tool?  I'm willing to explore any avenue here.

Thanks,
Will
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You can use Editor Select command to select features from your GraphicsLayer. You can try out this sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave

Notice that the "New Selection" button will allow you to draw an envelope around your region of interest.

Or you can use FindGraphicsInHostCoordinates to select your graphics.
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;  
GeneralTransform generalTransform = MyMap.TransformToVisual(Application.Current.RootVisual);
System.Windows.Point transformScreenPnt = generalTransform.Transform(e.GetPosition(this.MyMap));
Rect rect = new Rect(transformScreenPnt, new Size(500, 500));
var graphics = graphicsLayer.FindGraphicsInHostCoordinates(rect );
0 Kudos