2

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
 });
 map.graphics.clear();
 map.infoWindow.hide();
 var graphic = new Graphic(circle, circleSymb);
 map.graphics.add(graphic);

 <body>
<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?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 7, 2015 at 14:13
3
  • 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. Commented 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. Commented 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. Commented Apr 8, 2015 at 16:16

1 Answer 1

-1

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

answered Apr 22, 2015 at 15:02
1
  • Please provide code as text rather than pictures so that it can be copy/pasted for testing. Commented Mar 23, 2018 at 8:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.