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 .
Any help or idea on how to go about this will be much appreciated.
Thanks,
Rauf
Solved! Go to Solution.
@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){
let lat1Rads = toRad(lat);
let lon1Rads = toRad(lon);
const R_KM = 6371; // radius in KM
let d = radius/R_KM; //angular distance on earth's surface
let bearingRads = toRad(bearing);
let lat2Rads = Math.asin(
Math.sin(lat1Rads) * Math.cos(d) + Math.cos(lat1Rads) * Math.sin(d) * Math.cos(bearingRads)
);
let lon2Rads = lon1Rads + Math.atan2(
Math.sin(bearingRads) * Math.sin(d) * Math.cos(lat1Rads),
Math.cos(d) - Math.sin(lat1Rads) * Math.sin(lat2Rads)
);
return {
latitude: toDeg(lat2Rads),
longitude: toDeg(lon2Rads)
}
}
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.
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
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.
Ok, Thanks for your inputs. This gives me some direction to go forward.
Thanks,
Rauf
@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){
let lat1Rads = toRad(lat);
let lon1Rads = toRad(lon);
const R_KM = 6371; // radius in KM
let d = radius/R_KM; //angular distance on earth's surface
let bearingRads = toRad(bearing);
let lat2Rads = Math.asin(
Math.sin(lat1Rads) * Math.cos(d) + Math.cos(lat1Rads) * Math.sin(d) * Math.cos(bearingRads)
);
let lon2Rads = lon1Rads + Math.atan2(
Math.sin(bearingRads) * Math.sin(d) * Math.cos(lat1Rads),
Math.cos(d) - Math.sin(lat1Rads) * Math.sin(lat2Rads)
);
return {
latitude: toDeg(lat2Rads),
longitude: toDeg(lon2Rads)
}
}
Hi @AndyGup , Thanks a lot for your inputs. I will check it out and will update on the progress.
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;
}
function toDeg(radians){
return radians * 180 / Math.PI;
}
Hi @AndyGup , I am able to draw a line from a point based on given bearing (e.x. NE 0 deg 12 min 20 sec) and distance but couldn't find a way to draw a curved line from a point given bearing (e.x. NE 0 deg 12 min 20 sec), radius and arc length. Are you aware of how I can achieve it? Below is an example of how user will enter bearing, distance, radius and arclength values
Hi @mohammed_raufshaikh, I'm aware of the formulas to do it but haven't researched it recently, you might marked this post as answered and create a new post about curved lines to get better visibility from the community. Here's a simple example of how to draw a curved line between two points: https://community.esri.com/t5/arcgis-api-for-javascript-questions/how-to-draw-a-curved-line-between-...