原理就是使用先创建一个buffer,这个buffer是一个圆,然后去查询。
<span style="font-size:24px;"> bufferParams = new esri.tasks.BufferParameters();
bufferParams.geometries = [evt.mapPoint];
</span>
<span style="font-size:24px;">var radius = $('#applicationslider').slider("getValue");
bufferParams.distances = [radius];
bufferParams.outSpatialReference = map.spatialReference;
bufferParams.unit = esri.tasks.GeometryService.UNIT_METER;
var gsvc = new esri.tasks.GeometryService("http://localhost/arcgis/rest/services/POI/Geometry/GeometryServer");
gsvc.buffer(bufferParams, function showBuffer(buffer) {
var graphic = new esri.Graphic(buffer[0], polygonSymbol_F);
map.graphics.add(graphic);
applicationModelOneSearchExtent = new esri.geometry.Extent(applicationModelOneCenterX - radius, applicationModelOneCenterY - radius, applicationModelOneCenterX + radius, applicationModelOneCenterY + radius, new esri.SpatialReference({ wkid: 102100 }));
var queryTask = new esri.tasks.QueryTask(applicationModelOneSearchPOIURL);
var query = new esri.tasks.Query();
query.geometry = buffer[0];</span>
<span style="font-size:24px;">var bufferFeatureLayer = new esri.layers.FeatureLayer(applicationModelOneSearchPOIURL,
{
mode: esri.layers.FeatureLayer.MODE_SELECTION,
outFields: ["*"]
});
bufferFeatureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, completeCallBack, ErrorCallBack)}
</span>