Project AgsPoint (spatial reference 4326 to spatial reference 102100)

below formula converts 4326 latitude to 102100 latitude

+ (double)toWebMercatorYdouble)latitude
{
double rad = latitude * 0.0174532;
double fsin = sin(rad);

double y = 6378137 / 2.0 * log((1.0 + fsin) / (1.0 - fsin));

return y;
}

below formula converts 4326 longitude to 102100 longitude
+ (double)toWebMercatorXdouble)longitude
{
double x = longitude * 0.017453292519943 * 6378137;

return x;
}

See my attachment , it contains a utility mercator convertor . You can simply import the class in your project and call the above static methods on it

Archive.zip‎

原文地址:https://www.cnblogs.com/suncf/p/4090625.html