0

I am stuck, trying to figure out how to create a simple graphic for adding a circle based on one point in my web map. I need the circle to be centered on my single point, with a radius of 5 miles. I saw examples for the geodesic circle and that didn't work for me, as well a creating a buffer, which I don't think I need. I just need a simple circle graphic. Is there a simple way to do this? I have a map with one point and need this graphic for a boundary. I apologize as I am new to this and trying to learn this API quickly.

thanks

asked Jun 11, 2014 at 19:12
4
  • Are you talking about this sample when saying the geodesic circle didn't work? Commented Jun 11, 2014 at 20:18
  • Yes, that works for me. But I just need a basic example of how to add a circle based on a point. I can just add that code to what I have to make it work and I just need a simple example, the fewer lines the better. Commented Jun 11, 2014 at 20:19
  • Do you mean you want the code to show a circle from a pre-existing point and not where the user clicks? Commented Jun 11, 2014 at 20:24
  • Yes, however I do not need any onClick function. Just a fixed or static circle, centered on the single point. Thanks! Commented Jun 11, 2014 at 20:46

3 Answers 3

1

This will give you a 5 mile geodesic circle around a predefined point.

<!DOCTYPE html>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
 <title></title>
 <link rel="stylesheet" href="//js.arcgis.com/3.9/js/esri/css/esri.css">
 <style>
 html, body, #map {
 height: 100%;
 width: 100%;
 margin: 0;
 padding: 0;
 }
 </style>
 <script src="//js.arcgis.com/3.9/"></script>
 <script>
 var map;
 require([
 "esri/map", "esri/geometry/Circle", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol",
 "esri/graphic", "esri/geometry/Point", "esri/Color",
 "dojo/domReady!"
 ], function (
 Map, Circle, SimpleFillSymbol, SimpleMarkerSymbol, SimpleLineSymbol,
 Graphic, Point, Color
 ) {
 map = new Map("map", {
 basemap: "streets",
 center: [-77.036744, 38.897731],
 zoom: 12
 });
 var symbol = new SimpleFillSymbol().setColor(null).outline.setColor("blue");
 var symbolPoint = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_X, 10,
 new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1),
 new Color([0, 255, 0, 0.25]));
 map.on("load", function () {
 var point = new Point([-77.036744, 38.897731]);
 var pointGraphic = new Graphic(point, symbolPoint);
 map.graphics.add(pointGraphic);
 var circle = new Circle(point, {
 radius: 5,
 radiusUnit: esri.Units.MILES,
 geodesic: true
 });
 var circleGraphic = new Graphic(circle, symbol);
 map.graphics.add(circleGraphic);
 });
 });
 </script>
</head>
<body>
 <div id="map"></div>
</body>
</html> 
answered Jun 12, 2014 at 15:48
1

From the ArcGIS website: it looks like your simplest bet is the buffer tool

you should be able to draw a buffer circle with the examples containing the buffer_analysis() command located on the page link above.

There was also some discussion earlier about creating a simplified circle polygon instead of the buffer tool you might be intereseted in checking out.

answered Jun 11, 2014 at 19:31
2
  • I know how to create a buffer in ArcGIS, I am referring to the ArcGIS API for JavaScript. Not python, am I in the wrong forum? Wait, yeah I am trying to do this for my GIS website. Please advise... Commented Jun 11, 2014 at 20:15
  • my bad. I didn't catch the javascript tag. Commented Jun 11, 2014 at 20:51
1

Use your point as the basis for a circle geometry. The create circles sample shows how to use that class.

answered Jun 12, 2014 at 13:16
0

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.