I'm trying to combine the following Esri samples, to end up with the ability to create buffers based on a variable radius, that will then query data within the buffer zone.

https://developers.arcgis.com/javascript/jssamples/util_buffergraphic.html https://developers.arcgis.com/javascript/jssamples/query_buffer.html

I'm new to JS so I'm not sure if I'm on the right lines or not, but using the query_buffer as a template in my latest attempt, I'd thought that adding inputs for the distance and units to the HTML, then replacing the radius and radiusUnit values in the JS with this, would work.

 //when the map is clicked create a buffer around the click point of the specified distance.
    map.on("click", function(evt){
      circle = new Circle({
        center: evt.mapPoint,
        geodesic: true,
        radius: dom.byId("distance").vlaue,
        radiusUnit: dom.byId("unit").value
      var graphic = new Graphic(circle, circleSymb);

<span id="messages">Click on the map to select census block points within buffer.</span>
    <div><b>Buffer Parameters: </b>
Distance:&nbsp;<input type="number" id="distance" size="5" value=1 />
<select id="unit" style="width:100px;">
  <option value="esriMiles">Miles</option>
  <option value="esriFeet">Feet</option>
  <option value="esriKilometers">Kilometres</option>
  <option value="esriMeters">Metres</option>
</select><br /></div>
<div id="mapDiv"></div>

However, when testing this, it doesn't seem to be picking up the radius values, and won't draw the buffer.

Any ideas?

  • 1
    I have no idea if this is the issue, but I'm guessing that the end of this line does not help, radius: dom.byId("distance").vlaue. Are you getting errors in developer tools in whatever browser you are using. Apr 7, 2015 at 14:52
  • I think John's comment solves the problem. I started with the query buffer sample, changed the radius and radiusUnit values to match what you have, and replaced the body to what you have in the sandbox and it is working for me. Apr 7, 2015 at 15:11
  • Problem solved, thanks for taking a look guys. That line was coming back as an error but I wasn't sure what was wrong with it. Knowing that it worked for you (jbchurchill), I figured I must be on the right lines, but missed something small. Turend out to be the order I had dojo/dom in the require. Moving it to the start of that seems to have worked.
    – MickGC
    Apr 8, 2015 at 16:16

1 Answer 1


Code for buffer radiusTry this attached Code. it should work.

  • Please provide code as text rather than pictures so that it can be copy/pasted for testing.
    – PolyGeo
    Mar 23, 2018 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.