//经纬度转墨卡托
(CGPoint)lonLat2Mercator:(CGPoint) lonLat
{
CGPoint mercator;
double x = lonLat.x *20037508.34/180;
double y = log(tan((90+lonLat.y)*M_PI/360))/(M_PI/180);
y = y *20037508.34/180;
mercator.x = x;
mercator.y = y;
return mercator ;
}
//墨卡托转经纬度
(CGPoint)Mercator2lonLat:(CGPoint) mercator
{
CGPoint lonLat;
double x = mercator.x/20037508.34*180;
double y = mercator.y/20037508.34*180;
y= 180/M_PI*(2*atan(exp(y*M_PI/180))-M_PI/2);
lonLat.x = x;
lonLat.y = y;
return lonLat;
}