I am creating an application that allow the user to specify geolocation data, which will then be rendered as a node onto a vector Mercator projection vector image.
So i've bought the following Mercator projection vector image: https://www.vectorstock.com/royalty-free-vector/world-map-gray-mercator-projection-lasercut-vector-23277786
I've found a formula to convert geolocation data to pixels from the following article: Convert latitude/longitude point to a pixels (x,y) on mercator projection
However, the conversion is not correct, and i assume it has to do with the image i use is not a "Normal" Mercator map (85deg) like the one used in the example.
My question is therefore: Is there a way i could achieve what i want with the provided image? if yes, i would like some help with the code provided below. If not, i would really appriciate if you could provide a url for a image (vector, free or for sale) that would work, which has the same style as the one provided.
Thanks alot!
public mapWidth: number = 2476;
public mapHeight: number = 1607;
public node: NodeLocation = { latitude: 8.161366, longitute: 77.454603, x: null, y: null };
public render() {
let latitudeToRadians = ((this.node.latitude * Math.PI) / 180);
let mercN = Math.log(Math.tan((Math.PI / 4) + (latitudeToRadians / 2)));
this.node.x = ((this.node.longitute + 180) * (this.mapWidth / 360));
this.node.y = ((this.mapHeight / 2) - ((this.mapWidth * mercN) / (2 * Math.PI)));
}