garethmann

Select by buffer running multiple times on subsequent calls

Discussion created by garethmann on Nov 14, 2011
Latest reply on Nov 15, 2011 by garethmann
I am working on a page that allows a user to search out an address and get demographic data about the surrounding area. The process is simply:

geocode->buffer->query layer 1 by buffer->select and query layer 2 by same buffer.


There are 2 relevant data layers in the GIS Service that it pulls from:

1) 2000 Census Tracts with ACS 05-09 data This shows older census tracts boundaries and is turned off in the service so users cannot actually see the boundaries. I am using the simple query by buffer code that i found here to pull the data from this layer:
http://help.arcgis.com/en/webapi/javascript/arcgis/demos/query/query_buffer.html

1) 2010 Census Tracts  This shows the latest census tracts. This layer is turned on and because I need the user to see which census tracts from this layer were included in the analysis, I am selecting (rather than simply querying) the features from this layer using the buffer.

Here is the page and the code:
http://northmiamicra.org/marketanalysis.html

For some reason, the first query rarely gets called (about 1 in 4 times), whereas the selection query on the second layer gets called the same number of times that the button on the page is pressed since the last page refresh. So when you press the button that says "find address", it will output the results of the request once. But then if you hit the button again, it will run the query twice and output the results twice. If you hit the button a third time it will run it 3 times and output the results 3 times, and so on....

So I wanted to find out the following:

1) Why is the first query almost never getting completed?

2) Why does the second query get run multiple times on second and third requests? (I have tried to be careful to empty out my variables and clear the map graphics before running the request a second time).

Outcomes