SUBROUTINE MAPCTN(GRID,X,Y,Z,N,AX,AY,AZ, ICT) 

 C ROUTINE TO MAP DATA VALUES(Z) WITH ASSOCIATED POSITIONS 

 C (X=LONG DECIMAL DEG.,Y=LAT DECIMAL DEG. )FROM A RELATIVELY STRAIGHT 

 C SEGMENT OF SURVEY TRACK ONTO A STRAIGHT LINE, AD JUST THE (Z) VALUE FOR 

 C THE AMOUNT OF SHIFT REQUIRED BY THE MAPPING AND INTERPOLATE NEW (Z) 

 C VALUES(AZ) AT AN EQUALLY SPACED DISTANCE(GRID IN DECIMAL NAUTICAL MI. 

 C AND ASSOCIATED POSITIONS AX, AY ALONG THIS STRAIGHT LINE. 

 C** N=NO.OF ORIGINAL X,Y,Z INPUT PTS., ICT= NO. OF OUTPUT PTS. 

 C** NOTE -SINCE THIS IS A CARTESIAN MAP WHICH DOES NOT ACCOUNT FOR LONG 

 C CONVERGENCE, IT SHOULD NOT BE USED FOR SEGMENTS COVERING A LARGE 

 C LATITUDE RANGE. 



C** NOTE -ORIGINAL XYZ DATA IS DESTROYED IN THIS ROUTINE 

 C*** THIS ROUTINE CALLS GINT, SPLINE, SPLICO.SORTY 



DIMENSION X ( 7000 ), Y ( 7000 ), Z ( 7000 ), AX ( 7000), AY ( 7000 ),AZ( 7000). 

 *DIST(7000) 



00 55 1=1,7000 

 55 DIST(I)=0.0 



JDIR=1 



IF(ABS(X(N)-X(1)).GE.ABS(Y(N)-Y(1))) JDIR=0 



ATER=9999.99 



RAD=0. 00029089 



BL0NG=X(1)*60.0 



BLAT=Y(1)*60.0 



DO 1 1=1, N 



IF(JDIR.EQ.1)G0 TO 3 



X(I)=BL0NG-X(I)*60.0 



Y(I)=Y(I)*60.0-BLAT 



GO TO 1 

 3 AY(I)=BL0NG-X(I)*60.0 



X(I)=Y(I)*60.0-BLAT 



Y(I)=AY(I) 

 1 CONTINUE 



AN=N 

 C MAP INPUT POSITIONS ONTO STRAIGHT LINE TO PREPARE DATA FOR 



C INTERPOLATION ON AN EQUAL DISTANCE BASIS 



A=0.0 



B=0.0 



C=0.0 



D=0.0 



DO 5 1=1, N 



A=A+X(I) 



B=B+X(I)**2 



C=C+Y(I) 

 5 D=D+Y(I)*X(I) 



A1=(C*B-D*A)/(AN*B-A**2) 



A2=(C-A1*AN )/A 



IF (ABS (A2) .LT. 0. 000001 )A2=0. 000001 

 C LEAST SQUARES LINE IS Y=A1+A2X 



C NOW SEARCH FOR A POINT LESS THAN PIVOT DISTANCE FROM TRACK LINE 

 C TO USE FOR 1ST PIVOT AND MAP PTS. ONTO TRACK WITH CORRECT Z VALUE 

 C POINTS LT PIVOT DIST FROM TRACK WILL HAVE THEIR POSITS MAPPED ONTO 

 C THE TRACK BUT THEIR Z VALUE WILL NOT BE CHANGED 



SUM=0.0 



159 



