The jVectorMap world map uses a van der Grinten projection. The formula for converting from / to the map can be found here Wikipedia and Wolfram .
You will need to scale it to the size and offset of the map, given the above formula: long / lat (-180 to 180 degrees) to a Cartesian grid (-1 to +1).
In addition, the angles in the formula must be in radians, not degrees.
function vanDerGrinten(lat, lng) { lat = lat * Math.PI / 180; lng = lng * Math.PI / 180; var lng0 = 0; var A1 = 0.5 * Math.abs((Math.PI / (lng - lng0) - (lng - lng0) / Math.PI)); var phi = Math.asin(Math.abs(2 * lat / Math.PI)); var G = Math.cos(phi) / (Math.sin(phi) + Math.cos(phi) - 1); P = G * (2 / Math.sin(phi) - 1); Q = A1 * A1 + G; x0 = A1 * A1 * (G - P * P) * (G - P * P) - (P * P + A1 * A1) * (G * G - P * P); x1 = (A1 * (G - P * P) + Math.sqrt(x0)); x2 = (P * P + A1 * A1); x = sgn(lng - lng0) * Math.PI * x1 / x2; y = sgn(lat) * Math.PI * Math.abs(P * Q - A1 * Math.sqrt((A1 * A1 + 1) * (P * P + A1 * A1) - Q * Q)) / (P * P + A1 * A1); return { _x: x, _y: y }; }
source share