Results 1 to 7 of 7

Thread: Making a Mercator Projection from Scratch

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Community Leader Guild Sponsor Gidde's Avatar
    Join Date
    May 2009
    Location
    Michigan, USA
    Posts
    3,673

    Post

    Woot, thanks for the rep!

    Miles/Nautical miles/Kilometers is actually irrelevant as far as the spreadsheet goes ... the unit cancels out in the math when you go from whatever it is to pixels, since you're specifying both the actual size and the scale.

    I probably should have referenced where I got the math .... this is the site I found that finally made it click.

    http://www.math.upenn.edu/~ugrad/mac...ator/mcalc.htm

    Everywhere else, I could find the projection formula, but none of the sites actually explained how to take the projection formula and turn it into miles/inches/pixels/etc.

  2. #2
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    Well I think I am right in saying that the Mercator is where the world is stretched so that the circumferences at every latitude are made to fit the width of the page.

    If that's correct then the circumference at latitude degree y is equatorial circumference multiplied by cos y. If page width in pixels is px then scale is px / (equ * cos(y)) or inverted if you want pixels per mile or whatever units your in.

    But anyway, I think its not too complicated or else I don't understand the real issue with it. Perhaps they use a non linear scale or a non angular scale for the latitude to py mapping...

  3. #3
    Community Leader Guild Sponsor Gidde's Avatar
    Join Date
    May 2009
    Location
    Michigan, USA
    Posts
    3,673

    Post

    Yep, correct in general terms. The reason the y values are logarithmic is that since the scale is continually changing, y is actually the integral of the scale equation. So the scale equation ends up being something like ...

    (px/unit of latitude)/equ*cos(lat)

    ... and the integral of 1/cos = ln(|sec+tan|), which is the projection formula (minus the units and scale).

    Yuck. Never thought I'd actually come up with a use for integral calculus ...

  4. #4
    Community Leader Guild Sponsor Gidde's Avatar
    Join Date
    May 2009
    Location
    Michigan, USA
    Posts
    3,673

    Post

    This is the current world map I'm working on, converted (roughly) from the equirectangular produced by PlanetGen to the mercator I wanted to work from, using the calcs in the above worksheets.

    Sorry for the jarring black and white of land vs sea ... the conversion is a LOT of work, so I'm using the working map rather than a prettier one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •