Hello everyone, First of all, sorry for my english.I am looking for how to build a point from another point according to a distance(meters) and a angle(degree).Olivier
Hi, Thank you for your answer.I am worry that this method will not be precise enough as the earth is a sphere. But I could still have a try.I keep you in touch.Olivier
Hello Dlimos, I tried what you advised me to do and this is perfectly working !! Thank you a lot !To any people that might face this problem, this is the js function I used :function buildPoint(point,angle, nav_long){Â Â Â var coord = esri.geometry.lngLatToXY(point.getLongitude(),point.getLatitude(),true);Â Â Â var ox = coord[0]+ Math.cos(angle/180*Math.PI)*nav_long;Â Â Â var oy = coord[1] + Math.sin(angle/180*Math.PI)*nav_long;Â Â Â var newPoint = new esri.geometry.Point(esri.geometry.xyToLngLat(ox,oy),new esri.SpatialReference({Â Â Â Â Â Â Â wkid:4326Â Â Â }));Â Â Â return newPoint;}OlivierL
gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); outSR = new esri.SpatialReference({ wkid: 32631}); startingSR = new esri.SpatialReference({ wkid: 4326}); function buildPoint(point,angle, nav_long){ Â Â Â gsvc.project([ point ], outSR, function(projectedPoints) { Â Â Â Â Â Â Â var pt = projectedPoints[0]; Â Â Â Â Â Â Â var ox = pt.x + Math.cos(angle/180*Math.PI)*nav_long; Â Â Â Â Â Â Â var oy = pt.y + Math.sin(angle/180*Math.PI)*nav_long; Â Â Â Â Â Â Â var newPoint = new esri.geometry.Point(ox, oy,new esri.SpatialReference({ Â Â Â Â Â Â Â Â Â Â Â wkid:outSR Â Â Â Â Â Â Â })); Â Â Â Â Â Â Â gsvc.project([ newPoint ], startingSR, function(projectedPoints2) { Â Â Â Â Â Â Â Â Â Â Â var pt2 = projectedPoints2[0]; Â Â Â Â Â Â Â Â Â Â Â return pt2; Â Â Â Â Â Â Â }); Â Â Â }); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.