Build a point with distance and degrees

987
11
Jump to solution
04-08-2013 05:31 AM
OlivierLevasseur
New Contributor II
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
0 Kudos
11 Replies
DavideLimosani
Occasional Contributor II
I think that for Le Havre UTM30n (wkid:32630) or UTM31n (wkid: 32631) are good.

( look here http://spatialreference.org/ref/epsg/32631/ and here http://spatialreference.org/ref/epsg/32630/ which is the best for you... i think that Le Havre is on the border...)

Try this:

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;

        });
    });
}




I haven't tested it, but it can be a starting point.

Davide
0 Kudos
OlivierLevasseur
New Contributor II
Hi,

I finaly found a solution on the website http://www.movable-type.co.uk/scripts/latlong.html

Cheers for your help

Olivier
0 Kudos