Least square tool to align multiple local points to geodetic points

Least square tool to align multiple local points to geodetic points

pierrot.dufour
Contributor Contributor
2,083 Views
6 Replies
Message 1 of 7

Least square tool to align multiple local points to geodetic points

pierrot.dufour
Contributor
Contributor

Hi everybody,

 

As I am working in legal surveying, I need to perform least square adjustement to « align » some local points to their correspondance in geodetic.

From now, I've been using « Cadarp » to do so.

 

What I want to do is simple. It's just like an « align » using multiple points with the ability to check the deviation (error).

 

Thanks a lot for help!

 

Cheers from Quebec!

0 Likes
2,084 Views
6 Replies
Replies (6)
Message 2 of 7

CyrusLSteele
Enthusiast
Enthusiast

The survey network function in Civil 3D should be able to handle the least squares adjustment and can show the error elipses. If your drawing is set with the proper coordinate system settings, it will also handle the transfer from ground observations to grid.

 

https://knowledge.autodesk.com/support/autocad-civil-3d/getting-started/caas/CloudHelp/cloudhelp/201...

 

Message 3 of 7

pierrot.dufour
Contributor
Contributor
Hi there,

Don't you think the survey network is only designed to adjust a "traverse"?

Thanks for help
0 Likes
Message 4 of 7

CyrusLSteele
Enthusiast
Enthusiast

The least squares adjustment is performed to the survey network which includes all observations you have put into it. Traverses are a a sub entity within the survey network however side shots are also part of the network. They would be included with your observations at each setup.

 

0 Likes
Message 5 of 7

caddie99
Advocate
Advocate
I use a helmert transformation to do something similar I posted a lisp on this forum a while ago
0 Likes
Message 6 of 7

pierrot.dufour
Contributor
Contributor

Hello Caddie99,

 

As you mentionned, I check out for the « Helmert Transformation » compatible with Civil 3D and this is what I found.

Since I can force the scale factor to 0 and choose between multiple corresponding points, it's seems exactly what I need!

Is it the application you're talking about?

 

Cheers

 

 

Helmert.JPG

0 Likes
Message 7 of 7

caddie99
Advocate
Advocate

 

;WATCH YOUR UNITS - EARLY ESCAPE DOES NOT RESET THEM

;
; Graphical Helmert's transformation
; ----------------------------------
(defun C:Helmert ( / lun lup aun aup ang ib1 ib2 x1 y1 X2 Y2
q ib xt1 yt1 Xt2 Yt2 t1 t2 dx dy ir Xx Yy xr yr
a1 a2 b1 2b c1 c2 sa1 sa2 sb1 sb2 sc1 sc2
at bt qt wt wtr wtd scl et)

(setq lun (getvar "LUNITS"))
(setq lup (getvar "LUPREC"))
(setq aun (getvar "AUNITS"))
(setq aup (getvar "AUPREC"))
(setq ang (getvar "ANGDIR"))

(setvar "LUNITS" 2)
(setvar "LUPREC" 3)
(setvar "AUNITS" 2)
(setvar "AUPREC" 4)
(setvar "ANGDIR" 1)

(setq ib1 (getpoint "\n 1st identical point (source) : "))
(setq ib2 (getpoint ib1 "\n 1st identical point (target) : "))
(setq x1 (list (car ib1)))
(setq y1 (list (cadr ib1)))
(setq X2 (list (car ib2)))
(setq Y2 (list (cadr ib2)))
(grdraw ib1 ib2 5)

(setq ib1 (getpoint "\n 2nd identical point (source) : "))
(setq ib2 (getpoint ib1 "\n 2nd identical point (target) : "))
(setq x1 (append x1 (list (car ib1))))
(setq y1 (append y1 (list (cadr ib1))))
(setq X2 (append X2 (list (car ib2))))
(setq Y2 (append Y2 (list (cadr ib2))))
(grdraw ib1 ib2 5)

(setq q "Y"
ib 2)
(while (/= q "N")
(initget "Y N")
(setq q (getkword "\n Next point ? Yes/No <Y> : "))
(if (or (= q "y") (= q "Y") (= q nil))
(progn
(setq ib1 (getpoint "\n Next identical point (source) : "))
(setq ib2 (getpoint ib1 "\n Next identical point (target) : "))
(setq x1 (append x1 (list (car ib1))))
(setq y1 (append y1 (list (cadr ib1))))
(setq X2 (append X2 (list (car ib2))))
(setq Y2 (append Y2 (list (cadr ib2))))
(setq ib (+ 1 ib))
(grdraw ib1 ib2 5)
)
)
)

(setq xt1 0.0
yt1 0.0
Xt2 0.0
Yt2 0.0)
(foreach p x1 (setq xt1 (+ xt1 p)))
(foreach p y1 (setq yt1 (+ yt1 p)))
(foreach p X2 (setq Xt2 (+ Xt2 p)))
(foreach p Y2 (setq Yt2 (+ Yt2 p)))
(setq xt1 (/ xt1 ib))
(setq yt1 (/ yt1 ib))
(setq t1 (list xt1 yt1))
(setq t2 (list (/ Xt2 ib) (/ Yt2 ib)))
(setq dx (- (nth 0 t2) (nth 0 t1)))
(setq dy (- (nth 1 t2) (nth 1 t1)))

(grdraw t1 t2 6)

(setq ir 0)
(setq Xx nil
Yy nil
xr nil
yr nil)
(while (< ir ib)
(setq Xx (append Xx (list (- (nth ir X2) (nth ir x1)))))
(setq Yy (append Yy (list (- (nth ir Y2) (nth ir y1)))))
(setq xr (append xr (list (- (nth ir x1) xt1))))
(setq yr (append yr (list (- (nth ir y1) yt1))))
(setq ir (+ 1 ir))
)

(setq ir 0)
(setq a1 nil
a2 nil
b1 nil
b2 nil
c1 nil
c2 nil)
(while (< ir ib)
(setq a1 (append a1 (list (* (nth ir Xx) (nth ir xr)))))
(setq a2 (append a2 (list (* (nth ir Yy) (nth ir yr)))))
(setq b1 (append b1 (list (* (nth ir Yy) (nth ir xr)))))
(setq b2 (append b2 (list (* (nth ir Xx) (nth ir yr)))))
(setq c1 (append c1 (list (* (nth ir xr) (nth ir xr)))))
(setq c2 (append c2 (list (* (nth ir yr) (nth ir yr)))))
(setq ir (+ 1 ir))
)

(setq ir 0)
(setq sa1 0.0
sa2 0.0
sb1 0.0
sb2 0.0
sc1 0.0
sc2 0.0)
(while (< ir ib)
(setq sa1 (+ sa1 (nth ir a1)))
(setq sa2 (+ sa2 (nth ir a2)))
(setq sb1 (+ sb1 (nth ir b1)))
(setq sb2 (+ sb2 (nth ir b2)))
(setq sc1 (+ sc1 (nth ir c1)))
(setq sc2 (+ sc2 (nth ir c2)))
(setq ir (+ 1 ir))
)

(setq at (/ (+ sa1 sa2) (+ sc1 sc2)))
(setq at (+ 1 at))
(setq bt (/ (- sb1 sb2) (+ sc1 sc2)))
(setq qt (sqrt (+ (* at at) (* bt bt))))
(setq wt (atan bt at))
(setq wtr (* (1- 0) (/ (* 200.0 wt) pi)))
(setq wtd (* (1- 0) (/ (* 180.0 wt) pi)))

(setq q "Y")
(initget "Y N")
(setq q (getkword "\n Apply scale q? Yes/No_(q=1)/User <Y> : "))
(if (or (= q "y") (= q "Y") (= q nil))
(setq scl qt)
)
(if (or (= q "n") (= q "N"))
(setq scl 1.0)
)
(if (or (= q "u") (= q "U"))
(setq scl (getreal "User's scale : "))
)
(setq et (ssget))
(setq q "N")
(initget "N Y")
(setq q (getkword "\n Keep the original drawing ? No/Yes <N> : "))
(if (or (= q "y") (= q "Y"))
(command "_copy" et "" "0,0,0" "0,0,0")
)
(command "_move" et "" "_none" t1 "_none" t2)
(command "_rotate" et "" "_none" t2 wtr)
(command "_scale" et "" "_none" t2 scl)

(princ
(strcat "\n dY : " (rtos dx 2 3) " dX : " (rtos dy 2 3)
"\n w : " (rtos wtr 2 4) "g " (rtos wtd 2 5) "° q : " (rtos scl 2 8)
)
)

(setvar "LUNITS" lun)
(setvar "LUPREC" lup)
(setvar "AUNITS" aun)
(setvar "AUPREC" aup)
(setvar "ANGDIR" ang)

)
;======Konec

0 Likes