Monday, October 10, 2011

Hexmogrifying Google Earth

This is my 200th post and my 42nd birthday all rolled into one, so I thought I'd do something special.

I've been a fan of Alexis' world hex mapping project for a while - even back before I had heard of the OSR Blogosphere.  I love maps, and putting one into hex form immediately screams 'adventure' to me.

I wanted to try out hexing the real world myself, and though Texas would be a great place to start.  I love the geography of my home state.  You've got deserts and swamps and mountains and hills and nice and comfy broadleaf forests and painfully tall swaths of pine and islands and plains and marshes and canyons and playa lakes and - geez - lots of wonderful, different places that confuse the hell out of some foreign types who land at Austin and are surprised they don't see cacti and cowboys.

So, I sat down to do it.  Several times.  What a frikkin pain in the ass!  The world is not designed to be mapped out in hex - just like it's not designed to be mapped out on a flat piece of paper either.  Finding maps, lining everything up, trying to keep the boundaries of each hex happy with every other - geez.  It's definitely a labor of love.

Being a programmer, I have a habit of noticing repetitive tasks.  If I have to do something more than three times, I have a great urge to automate it so I don't ever have to do it again.  Let's call it Engineer's ADHD.  I've made a career of being assigned a job, getting bored with it, automating it, finding something else that is repetitive and boring and automating that too, until everything at the company anyone could possibly ask me to do is automated and I can finally have a nice nap.  Efficiency and laziness are just different sides of the same coin.

The task of hexing the world lends itself to automation, so I started thinking about how to do it.  How could you standardly assign hexes to regions?  Latitude and Longitude, while wonderful for navigating the Seven Seas, is horrible for the human brain.  The hashmarks they form on the globe do not make squares of equal area - or squares at all, for that matter, so utilizing them out of the box to hang a hex map on was out of the question.  I had to break out the big guns.  I had to break out geometry and calculus.

I've carried around math books with various bizarre formula in them most of my life.  I'm not a fan of math.  Actually, I hate it.  That's why I love programming.  All I have to do is understand it - once - and tell the computer to do it.  POOF.  I never have to do it again.  Yeah, horrible and lazy, I know - but that's me.

This math challenge was beyond my dusty books, so I did some internet research.  Math geeks are wonderful. They make some awesome web pages.  The page that helped me out most was this one here - with the jaunty title of 'Calculate distance, bearing and more between Latitude/Longitude points.'  That gave me all the math I needed to be able to mathematically calculate the vertices of any sized hex and translate them into latitude and longitude coordinates.  With that data, I was set.

Then I was off to Google Earth.  I love that program, and have gotten lost in far away countries through it more often than I'd like to admit.  Our good friends at Google also offer lots of ways to manipulate Google Earth, from advanced APIs, to the simplicity of the KML file.  Simplicity is what I was after.

The KML file is kind of  like an HTML file, buy for maps.  While you can do all kinds of things with it - like draw embed 3d building into Google Earth, I just wanted to use it to draw lines.  With the latitude and longitude points generated with my ill-gotten formulae, I could draw hexes!  Woot!

See this little bit of the Texas coast for yourself - with 6 mile hexes:


Right now, the KML hex file creation system is manual in the fact that I have to seed it with an area and do a lot of copy-pasting within the KML file itself. But with a bit of time, I could have a system that could overlay whatever area you want with whatever size hexes you needed.  Of course, the curvature of the earth still makes things wonky at large scales (I, um, think - maybe,) but since the hex 'grid' is tied to latitude and longitude - hexing out out anything near the poles - even Antarctica, would not be a problem.

I could even add a system of graphic overlays with KML for each hex to show - oh - the post-apocalyptic differences between present day and the 'future' - turned on and off an the click of a mouse button.  The possibilities with Google Earth are nigh-limitless.  I sure as heck don't have a long enough lifespan to do all the things I can think about doing with it right now.

Of course, I much prefer the look of hand crafted hex maps, like those over at the Tao of D&D.  But I am a lazy-ass, ADHD prone software engineer, so looks like Texas won't be all pretty, but it sure as hell will have some hexes drawn on top of it. :)

Happy hexing!

- Ark





10 comments:

  1. I've wanted to "hexify" GE for some time now, since I was thinking of putting together a Mutant Future game. That never materialized due to lack ofplayer interest.

    ReplyDelete
  2. That is the coolest thing I have seen this week (albeit it just begun). Incredibly useful next time we are planning the family hexcrawl to the Gulf Coast.

    Happy victory lap around the sun btw.

    ReplyDelete
  3. I agree - Alexis's project is pretty amazing. I've wondered if there's an easy way to take mercator projections and hexography them (assuming you can live with the distortion).

    I hadn't considered playing around with google earth - so pardon my ignorance - is it possible to export the GE stuff as images an paste hexes over it in a drawing program. Wondering if you could achieve a much larger scale, like 1/4" = 6 miles or something. Heck, at that point you could import it into hexographer and paste tiles on top.

    Oh - and happy B-day!

    ReplyDelete
  4. @Higgi - Bummer. Hopefully another one will rise up like a phoenix in it's place - Maybe by then I'll have some more hexes done. :)

    @ckutalik - Why thank you. When in Freeport, Texas, beware a 15 on a d20. That means the DM just rolled DRAGON TURTLE.

    @Beedo - Google Earth is basically just like you are spinning a infinitely detailed globe around. There is no distortion, in a traditional sense, because it's like staring down from Low Earth Orbit at the planet. You can zoom in and zoom out at whatever granularity you wish - so you could easily get it to 1/4" = 6 miles. I think you should go play with it - it's free. :)

    - Ark

    ReplyDelete
  5. Nice job - I did the same thing a while back to illustrate hexes for my players - based it on our home town of Las Vegas.

    ReplyDelete
  6. "What a frikkin pain in the ass! The world is not designed to be mapped out in hex..."

    Welcome to my world.

    ReplyDelete
  7. @Matt - Very cool. I'm getting a picture of a Mad Max sand box in my head. :)

    @Alexis - You are a very dedicated mapper. I salute you - and your calluses.

    @Telecanter - Hey thanks!

    - Ark

    ReplyDelete
  8. Game day is up and almost everyone in America is tuning in to catch their favorite teams' matches. If you're green like me, then check out these useful tips on how to green your game day. I found this video tips on YouTube. http://youtu.be/bXCTr8b_FxA

    ReplyDelete
  9. Have you done any more work on this particular project? I'm setting up a campaign (loosely) based on Ancient Greece and setting up hexes in G.E. in 3 mi. and 24 mi radii would go a long way toward making my maps a lot easier to work with. (at least as a starting point... I'm short on time and big on ideas, but not very good with tedious programmy things...)

    Thanks!

    ReplyDelete