# Question : Another boring Lat/Long to X/Y question with bonus!

## Answer : Another boring Lat/Long to X/Y question with bonus!

##### No, that formula is not correct. I think the intent of that formula is to perform a linear interpolation, and if that is the case, the following is closer to what you want...mapWidth = 2860;mapHeight = 1900;mapLongW = -125; // Left bound of map is 125degWmapLongE = -65;    // Right bound of map is 65degWmapLatN = 50;        // Top bound of map is 50degNmapLatS = 25;        // Bottom bound of map is 25degNlocationLat = 30.52; // Latitude of point of interestlocationLong = -87.85; // Longitude of point of interestx = (locationLong - mapLongW) * mapWidth / (mapLongE - mapLongW);y = (locationLat - mapLatN) * mapHeight / (mapLatS - mapLatN);HOWEVER, this is not an accurate method of converting lat/long to x/y. This is performing LINEAR interpolation, which is fine for the x value as the horizontal scale is linear but the vertical scale is not linear, so you will get the right values at the top and bottom of the map, but the close to the middle the bigger the error that you will get.The error may be small enough for you to not be concerned about, but if you are the maths gets quite a bit more complicated. Have a you at the equations on this page....http://en.wikipedia.org/wiki/Mercator_projection
 Random Solutions