Projections used by Google Maps

Saturday, June 10th, 2006

Auckland my Auckland Someone asked me recently how to convert from a latitude & longitude to a Google Maps quadtree address (an URL to a particular image tile, as previously discussed in this entry), and I realized that I didn’t actually know. So I decided to work it out, and further realized that because it uses the Mercator projection it’s not as simple as I thought it would be.

One drawback of the Mercator projection is that it can never be complete, because at the upper and lower extremes of the map the magnification approaches infinity— which means that on an almost complete Mercator projection you would be able to read Santa’s newspaper, because it would appear as large as the Pacific Ocean!

For real world applications, if you want a map that’s not taller than it is wide you need to cut off the poles… but how much to cut off? Not really knowing this meant that I had to screw around comparing visual reference points (like the Empire State Building) in order to tweak the numbers to account for this, but I think I’ve got it almost right now. UPDATE: It was late, I was tired, and on second look I realized that the scale factor I had been zeroing in on (to seven decimal places) was in fact a natural one, in this case 1/2π. This should have been obvious to me from the equations in the Wikipedia entry. Also I know that the Mercator projection is conformal, which means you can’t go applying arbitrary scaling factors willy-nilly without screwing that up.

So go visit this page to see all the image tiles (from big to small) that contain a given set of coordinates, and feel free to view the source if you want to see the details of the conversion.

__________

UPDATE: For more technical information, including sample code, see this entry.

feed

11 Comments

  1. sc says:

    very good,if I have convert from a latitude & longitude to a Google Maps quadtree address (an URL to a particular image tile.How can I get all image tiles in one range from latitude to latitude and longitude to longitude.

  2. sc says:

    https://intepid.com/stuff/gmkh/
    In that url,I think the tip in one image to show address is wrong!

  3. mark says:

    There are several ways to approach a range of images… one way is to step from one tile to the next using a fairly simple algorithm. Visit the sample page again and you will see a 3×3 image built using tiles, you can see how by checking the source.

  4. sc says:

    HI,Thanks for your source.
    It is very good .
    Can you tell me another ways,I want to learn it.
    Why v=2 is disable now?
    Do you know?

  5. mark says:

    v=2 is not a very useful projection for google, because it is not conformal, which means that the further you get from the equator, the more distortion there is.

  6. sc says:

    I see,Thanks.

  7. sc says:

    Can you tell me another ways to get a range ,I want to learn it.

  8. mark says:

    It’s hard to say without actually writing the code, but basically you want to expand on the 3×3 method used in the sample. You need to get the tile address for your top-left coord system, and then just step out as many tiles as you need.

  9. andré says:

    hi,
    many thanx for your work! it gives me good hints for a quads based generalizing algorithm i want to implement ontop of Google Maps (but totally independent of their quadrant system).

    did you happen to check for tile borders coordinates in lat/long?

    gretings from tyrol/austria

  10. khalid omar says:

    too many thanx for your work
    but i need to know the coordinates of topleft or center of each tile

  11. mark says:

    All technical info can now be found here: https://intepid.com/2005-07-17/21.50/

Leave a Comment