1 #include "map.h" 2 3 static int 4 Xmercator(struct place *place, double *x, double *y) 5 { 6 if(fabs(place->nlat.l) > 80.*RAD) 7 return(-1); 8 *x = -place->wlon.l; 9 *y = 0.5*log((1+place->nlat.s)/(1-place->nlat.s)); 10 return(1); 11 } 12 13 proj 14 mercator(void) 15 { 16 return(Xmercator); 17 } 18 19 static double ecc = ECC; 20 21 static int 22 Xspmercator(struct place *place, double *x, double *y) 23 { 24 if(Xmercator(place,x,y) < 0) 25 return(-1); 26 *y += 0.5*ecc*log((1-ecc*place->nlat.s)/(1+ecc*place->nlat.s)); 27 return(1); 28 } 29 30 proj 31 sp_mercator(void) 32 { 33 return(Xspmercator); 34 } 35