Latitude/longtitude conversion to image x/y coordinates (Miller Cylindrical projection) – Stack Overflow

  1. Home
  2. map design tutorials
  3. Latitude/longtitude conversion to image x/y coordinates (Miller Cylindrical projection) – Stack Overflow

As already said in the title, I need some help with converting lat/long to x/y coords in Miller Cylindrical projection. I`m currently writing an app (in Java) which gets city list as an input and then gets lat/long for each city from Yahoo Placefinder. I used these formulas in my code. Here is an example of what I get. (image is for the reference only, not the one I use). As you can see the X positions are only a few pixels (2-3) off, this can be a problem with my calculations of prime meridian shift (CENTRAL_MERIDIAN_OFFSET) in this map. But the main problem is incorrect Y coordinates. Obviously, something is wrong with Y coord calculation. I`m not sure whether 5.6 should really be the right value but the vertical range of Millers projection was said to be -2.3..+2.3 in one of the references I read so I used it. Millers projection was said to be -2.3..+2.3 it is an approximation. Based on the size of an image you might need more precise value, for example 2.303412543 For latitude of Moscow as 55.7522222 it will give y = 1.089472895 and, based on the height of the image I used, y’ = 1499/2 – (1499/ (2 * 2.303412543)) * 1.089472895 = 395 pixels from the top, which is correct (I did not care about x). So, probably your image does not have equator in the middle of it. It can be fixed mathematically by addition of the shift to the formula, but you have to find position of the equator. Source.

Menu
whatsapp button