# Draw a line from a point knowing the direction and distance from it

607
10
12-23-2021 10:32 AM
New Contributor II

Hi Friends,

IS it possible to draw geometry by knowing the COGO dimension of a parcel from a deed of sale agreement using ARcgis Javascript API? I would like to start drawing from a know point and then traverse the geometry by entering the bearing, distance, radius and other cogo parameters.

Same operation can be performed in ArcGIS pro using the Traverse tool under COGO section https://pro.arcgis.com/en/pro-app/latest/help/editing/create-a-traverse.htm .

Thanks,

Rauf

Tags (1)
1 Solution

Accepted Solutions
by
Esri Regular Contributor

@mohammed_raufshaikh here's a snippet the will help you find the new point using latitude, longitude, bearing and radius (distance). That should at least get you started. Once you have the new point you can draw a polyline using the beginning and ending points. Here's a sample that demonstrates the concepts for creating a line (see item number 3 and 4): https://developers.arcgis.com/javascript/latest/sample-code/intro-graphics/

``````        function bearingDistance(lat, lon, radius, bearing){
const R_KM = 6371; // radius in KM
let d = radius/R_KM; //angular distance on earth's surface

);

);

return {
}
}``````

10 Replies
by
MVP Honored Contributor

The Parcel Drafter WAB Widget already does this, though it's only available in the 3.x JS API. You could open it up and see if you can convert its source code to work in the 4.x API.

- Josh Carlson
Kendall County GIS
New Contributor II

Hi Josh,

Thanks for your response but I don't see the Parcel Drafter Widget in 3.x JS API as well, looks like it is available as part of ArcGIS Web AppBuilder.

Thanks,

Rauf

by
MVP Honored Contributor

Yes, you'd probably need to download the WAB Developer Edition to look at what's going on in that widget, but it's built for the 3.x API.

- Josh Carlson
Kendall County GIS
New Contributor II

Ok, Thanks for your inputs. This gives me some direction to go forward.

Thanks,

Rauf

by
Esri Regular Contributor

@mohammed_raufshaikh here's a snippet the will help you find the new point using latitude, longitude, bearing and radius (distance). That should at least get you started. Once you have the new point you can draw a polyline using the beginning and ending points. Here's a sample that demonstrates the concepts for creating a line (see item number 3 and 4): https://developers.arcgis.com/javascript/latest/sample-code/intro-graphics/

``````        function bearingDistance(lat, lon, radius, bearing){
const R_KM = 6371; // radius in KM
let d = radius/R_KM; //angular distance on earth's surface

);

);

return {
}
}``````

New Contributor

Hi @AndyGup , Thanks a lot for your inputs. I will check it out and will update on the progress.

by
Esri Regular Contributor

Oops, 2 functions got cut off and I can't edit my previously reply. You'll also need these two functions:

``````        function toRad(degrees){
return degrees * Math.PI / 180;
}