Skip to content

Instantly share code, notes, and snippets.

@RosaryMala
RosaryMala / BingConvert.cs
Created May 28, 2016 07:23
Functions to convert between WGS84 and bing mercator
using System;
public class BingConvert
{
public static double[] WGS84toGoogleBing(double lon, double lat)
{
double x = lon * 20037508.34 / 180;
double y = Math.Log(Math.Tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return new double[] { x, y };