buffering features based on graphic extent instead of the graphic

374
0
04-16-2010 10:01 AM
eddiequinlan
Occasional Contributor
Can anyone solve this problem?  I've been fighting this for 3 months.

I have my own java code to buffer a parcel layer based on a graphic( ie radius).  However, I noticed the returned results seem to be based on the extent of the graphic and not the actual graphic itself.  I decided to copy the exact code from the "Community Gallery" for JAVA titled "Query parcels with buffer, show results in DojoX grid" and see what kind of results I get.

When I run the code pointing to the ESRI data the app runs fine.  Then, I went thru and only changed the urls to my data and a couple of the variable names; this is when it stopped working.  I discovered the problem to be the same as in my own java app.

Here is where I believe the issue is:

+++++Listen for GeometryService onBufferComplete event+++++
        dojo.connect(gsvc, "onBufferComplete", function(graphics) {  
          // Add the buffer to the screen
          var symbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleLineSymbol
                  ("dashdot", new dojo.Color([200,0,0]), 3), new dojo.Color([255,255,0,0.25]));
          var graphic = new esri.Graphic(graphics[0].geometry,symbol);
          map.graphics.add(graphic);

          // Set the query geometry equal to the buffer
          queryBufferedParcels.geometry = graphic.geometry.getExtent();  //Works but returns results based on extent.
          //queryBufferedParcels.geometry = graphic.geometry;
         
          // Query for parcels within the buffer
          queryTaskBufferedParcels.execute(queryBufferedParcels);
               
        });
       
The original ESRI example has "queryBufferedParcels.geometry = graphic.geometry;".  However this doesn't work with my data, but does with the ESRI url.

When I change it to "queryBufferedParcels.geometry = graphic.geometry.getExtent(); ", everything works great, but the results returned lie outside of the buffered graphic and are based on the graphic extent (obviously graphic.geometry.getExtent()).

I'm puzzeled why the url data would make a difference and/or why the "graphic.geometry" won't work.

Thank you,
Eddie Q.
0 Kudos
0 Replies