how to find new point with a x,y distance from a given point?

3359
4
06-19-2015 01:28 AM
alisonmez
New Contributor

how to find new point with a x,y distance from a given point?

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

A point and a distance will put you on a circle of that radius.  You also need a direction.

0 Kudos
alisonmez
New Contributor

sure, I asked x and y distance...

sorry my bad English!

0 Kudos
DanPatterson_Retired
MVP Emeritus

Ok I am not sure whether this is an api question or one on general geometry... The latter is Pythagorean theorem - Wikipedia, the free encyclopedia   If you have an origin point (x,y) and a distance and direction you can determine the coordinates of a new point (x0, y0)  Distance will solely give you the distance from the origin point, hence you need direction to position yourself on the circle which encompasses the origin at that distance.  I hope you are working with a planar/cartesion/projected coordinate system, otherwise you will have to deal with spherical coordinates (section 6.7 in the link provided)

If this is about api issues....never mind

0 Kudos
alisonmez
New Contributor

This is a silverlight api question. I can calculate distance between to points using a method like below.

My problem is I don't know wheter there is a way to reverse it?

        private double FindDistance(double x1, double y1, double x2, double y2)

        {

            ESRI.ArcGIS.Client.Geometry.SpatialReference aSpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);

            MapPoint aMapPoint1 = new MapPoint(x1, y1);

            MapPoint aMapPoint2 = new MapPoint(x2, y2);

            p1 = aMapPoint1.GeographicToWebMercator();

            p2 = aMapPoint2.GeographicToWebMercator();

            ESRI.ArcGIS.Client.Geometry.PointCollection pColl = new ESRI.ArcGIS.Client.Geometry.PointCollection();

            pColl.Add(p1);

            pColl.Add(p2);

            ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection> oColl = new ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection>();

            oColl.Add(pColl);

            ESRI.ArcGIS.Client.Geometry.Polyline pLine = new ESRI.ArcGIS.Client.Geometry.Polyline();

            pLine.Paths = oColl;

            pLine.SpatialReference = aSpatialReference;

            var graphic = new Graphic();

            graphic.Geometry = (ESRI.ArcGIS.Client.Geometry.Geometry)pLine;

            var geog = new ESRI.ArcGIS.Client.Projection.WebMercator();

            ESRI.ArcGIS.Client.Geometry.Polyline wgs = (ESRI.ArcGIS.Client.Geometry.Polyline)geog.ToGeographic(pLine);

            return ESRI.ArcGIS.Client.Geometry.Geodesic.Length(wgs);

        }

0 Kudos