Select to view content in your preferred language

Select, Buffer, Select More

2352
1
02-23-2012 01:25 PM
N_Young
Deactivated User
Hello.

I am altering the "attribute inspector outside of map" flex sample.  Using parcels.  I would really like to be able to buffer whatever I select and then add to the selection based on that buffer.  So - choose one or more parcels, buffer around them, and select more parcels that are within that buffer distance.  (Plain old intersect is fine).

I am able to do the selection of one parcel or a group of parcels and buffer them.  There is still an issue with that but I had it working okay.

My biggest issue, however, is selecting more parcels based on the buffer.

THE REALLY GOOD THING is that my selectByBuffer method DOES select a larger group of parcels based on the buffer.  That is wonderful.
THE REALLY BAD THING is that once it does that, the buffer graphic disappears and a flash player error comes up and I can't do anything else.  The error is RangeError: Error #2006: The supplied index is out of bounds.
Also bad - I used to be able to select different parcels and have a series of buffer graphics on the screen, but now I can only have one.

I do not understand every bit of mxml code but I'm doing my best to piece together things from samples.  I'm willing to study up but it helps a LOT to have someone point out a few major flaws for me!  That said, I am sure there are many major flaws in my code.  But my main question is why I encountered big problems once I tried to select more parcels using the buffer. (the selectByBuffer method)

In my code I make buffers in two different places - one is meant to be for one parcel that the the user clicks on the map, the other is supposed to be for a group of parcels that the user selects using the "Rectangle Select, Buffer" button.  This probably needs to be changed but that's what I got to work for me.

I tried to make things more clear by keeping the buffering in a separate function - but I didn't know how to get around needing "event.feature.geometry" (from the selected parcel) which is used to set buffer parameters.

Again...many issues I'm sure, but lead me to some more clarity if you can!

Thank you.

CODE ATTACHED.
Tags (2)
0 Kudos
1 Reply
N_Young
Deactivated User
A more simple question:

Can I set bufferParameters.geometries to be "the features that are currently selected in my feature layer"?

If so, what is the exact syntax for doing that?  My feature layer is just called fLayer.  I see that selectedFeatures is a property of feature layer.  I tried bufferParameters.geometries = [fLayer.selectedFeatures];
but so far that hasn't worked.

Tips?

I think that would be helpful because setting bufferParameters.geometries as event.feature.geometry or event.graphic.geometry is making things harder for me to code because it depends on the event.

Thank you.
0 Kudos