function drawPt (lat, lon, size, color, drawBorder){ var markerSymbol = new SimpleMarkerSymbol({ "color": color, "size": size, "type": "esriSMS", "style": "esriSMSCircle", "outline": { "color": [255, 255, 255], "width": 1, "type": "esriSLS", "style": "esriSLSSolid" }}); if (!drawBorder) markerSymbol = new SimpleMarkerSymbol({ "color": color, "size": size, "type": "esriSMS", "style": "esriSMSCircle"}); var point = new Point({ "x": lon, "y": lat, "spatialReference": {"wkid": 4326 }}), markerSymbol = markerSymbol; var pointGraphic = new Graphic(point, markerSymbol); graphicsLayer.add(pointGraphic);} function toRadians(degrees){ return degrees * (Math.PI / 180);} function drawEl(lat, lon, major, minor, angle) { var h = lon; // x coord of ellipse centre (in degrees) var k = lat; // y coord of ellipse centre (in degrees) //The scale is close when i divide these variables by 200000...(= minor/200000)(= major/200000) var a = minor; //originally in meters var b = major; //originally in meters var ang = (0-(toRadians(angle))); // rotation, counter-clockwise, from north (I added "0-" to get the additive inverse because 'angle' is a bearing that runs clockwise.) var points = []; for (var i = 0; i < 360; i++) // one point per degree, change if you wish { var t = toRadians(i); // ellipse math var x = a * (Math.cos(t)); // ellipse math var y = b * (Math.sin(t)); // ellipse math var rot_x = h + (x*Math.cos(ang)) - (y * Math.sin(ang)); // rotate/transpose ellipse var rot_y = k + (y*Math.cos(ang)) + (x * Math.sin(ang)); // rotate/transpose ellipse points.push(new Point(rot_x, rot_y)); // save points to list drawPt(rot_y, rot_x, 2, [100, 100, 0], false); } } |