Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:43:10+00:00 2026-05-30T03:43:10+00:00

As already said in the title, I need some help with converting lat/long to

  • 0

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.

Here is my code (updated – 34px compensation for equator offset):

public final double W = 6343;
public final double H = 4767 - 34;

protected Point toMillerXY(double lon, double lat)
{
    double x, y;

    lon = Utils.degToRad(lon);
    lat = Utils.degToRad(lat);

    x = lon - CENTRAL_MERIDIAN_OFFSET;
    y = 1.25 * Math.log( Math.tan( 0.25 * Math.PI + 0.4 * lat ) );

    x = ( W / 2 ) + ( W / (2 * Math.PI) ) * x;
    y = ( H / 2 ) - ( H / ( 2 * 2.303412543 ) ) * y;

    y += 34;

    return new Point(x, y);
}

Output:  
Fetching data with: http://where.yahooapis.com/geocode?location=Buenos+Aires,Argentina
Latitude: -34.608521, longitude: -58.373539
---
Fetching data with: http://where.yahooapis.com/geocode?location=Tokyo,Japan
Latitude: 35.670479, longitude: 139.740921
---
Fetching data with: http://where.yahooapis.com/geocode?location=Cape+Town,CAR
Latitude: -33.919060, longitude: 18.421961
---
Fetching data with: http://where.yahooapis.com/geocode?location=Rome,Italy
Latitude: 41.903110, longitude: 12.495760
---
Total cities: 4
Result for Buenos Aires: 1964.598428, 3046.740995
Result for Tokyo: 5455.265150, 1732.669551
Result for Cape Town: 3317.692474, 3032.814395
Result for Rome: 3213.276105, 1602.176163

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:43:12+00:00Added an answer on May 30, 2026 at 3:43 am

    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).

    Check it, I placed a red dot on the map.
    http://img7.imageshack.us/img7/9892/mapue.jpg

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using json-framework and need some help though parsing some JSON i'm getting
Already found this page with some helpful hints. Problem is I need to debug
As already said in the title, how do i export a table into Excel
I already have an enterprise Java EE application. I want expose some of the
i already had 2008 express sql server but for some reason it came without
It is often said that, you should not rebase commits that you have already
I know that almost everything is already said about CMSs, but what interests me
As already said by the headline, I get a compile error I seem to
I've said this about a million times already, but I'm still new to ASP.Net
I need to create different page views for different types of users. I already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.