Select to view content in your preferred language

Trying To Buffer Points But Separate Buffers That Overlap Another Point

1251
7
Jump to solution
08-31-2012 01:49 PM
RyanCoodey
Frequent Contributor
I have a point feature layer that we want to buffer (easy enough) but then symbolize any buffer that overlaps another point a different color (need help here)...

Here is what I am doing now:
Step 1) Create a graphics layer.
Step 2) Setup a UniqueValueRenderer with different symbology for an attribute field I'm calling "IntersectIndicator".
Step 3) Assign the UniqueValueRenderer to the graphics layer.
Step 4) Call the GeometryService.BufferAsync() and I get back the buffers I want.
Step 5) Set the attribute ???IntersectIndicator" for each buffer graphic. (STUCK HERE)
Step 6) Set the source for our graphics layer to our buffer graphics.

Things I have thought/tried:

1) Loop through all the buffer results and in that loop through all the feature layer points like so:
            foreach (var bufferGraphic in e.Results)             {                 bufferGraphic.Attributes.Add("IntersectIndicator", "N");                 foreach (var featureLayerGraphic in WorkActivityFeatureLayer.Graphics)                 {                     if (bufferGraphic.Geometry.Extent.Intersects(featureLayerGraphic.Geometry.Extent))                     {                         bufferGraphic.Attributes["IntersectIndicator"] = "Y";                         break;                     }                 }             }

Problems with this are it is not removing the point the buffer was created from so it always intersects and also using a square extent for a circle buffer is not accurate.

2) Since I cannot send multiple graphics to the intersect or spatial query task I could union them first... but I still have the issue of the result always returning true because the original point is included.  Also the Buffer service does not retain any attributes from the original points so not sure how I would join the results for the intersection back in.

We are still running on the 2.4 API (waiting on our company to get me an EDN subscription for runtime)

Any help or ideas would be great!  Thanks a lot.
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
As the distance between 2 points is easy to calculate at client side, you can alternatively do the work at client side.
I put a SL sample here (but not that easy to extent to others geometry types)

View solution in original post

0 Kudos
7 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

You could try an intersect using the GeometryService (http://sampleserver3.arcgisonline.com/ArcGIS/SDK/REST/index.html?intersect.html) but I think you'd need to iterate over the buffers passing the points as the input geometries (or the opposite, iterate over the points passing the buffers as input geometries). Alternatively you could look at rolling the buffer and intersect into a single Geoprocessing model and publishing that as a Geoprocessing service.

Cheers

Mike
0 Kudos
DominiqueBroux
Esri Frequent Contributor
As the distance between 2 points is easy to calculate at client side, you can alternatively do the work at client side.
I put a SL sample here (but not that easy to extent to others geometry types)
0 Kudos
RyanCoodey
Frequent Contributor
Thanks a lot Mike and Dominique!

So Dominique's example is pretty much exactly what I needed... thanks for pointing out your "Yet Another Interactive Samples" page.  I like making both the buffers and proximity check client side, that is great!

After implementing this I have one more issue... our map is in geographic coordinates (WGS_84)(we haven�??t moved to the projected Web Mercator because the newer ESRI and Bing base map services are missing tiles at lower resolutions in some areas we need).  So the problem is that the buffers are off in the vertical/latitude direction... any easy way to implement this?  Or would that be some ugly calculations based off the coordinate system?  I got it working using the buffer geometry service and they come back correct, I am ok with this, though the client side buffers are nifty... so visually they are correct�?� but correct me if I�??m wrong, the distance calculations are slightly off, is this correct?

Thanks again!
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Ryan,

I updated the sample to work for both cases : euclidian or geodesic calculations.

Hope this helps.
0 Kudos
RyanCoodey
Frequent Contributor
You�??re awesome Dominique!  Thanks a ton, I really appreciate it!

The "Code Behind C#" and "XAML" pages are not showing in the Silverlight app though... it�??s just blank?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The "Code Behind C#" and "XAML" pages are not showing in the Silverlight app though... it�??s just blank?

Should be OK now. Sorry about that.
0 Kudos
RyanCoodey
Frequent Contributor
Bingo!  Thanks again for all the help!
0 Kudos