Creating a Map from Digital Terrain Data and Google Maps

Ins and Outs of Creating the Map
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

I remember that when I went to install some of this DEM-related stuff I had to wing it on the installation process. Unfortunately it was so long ago that I don't remember the details. I do remember that it wasn't incredibly convoluted though. TBH I can't even remember what OSGeo4W is. IIRC I installed MicroDEM but not much else.
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
Just Crazy Jim

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

I've gone several rounds with this install and never got the bit that Oilcan references. I have an antique version of ArcGIS intended for the DOS 6.0/Windows 3.0 era around here somewhere... but I imagine 1) I'd need to get a floppy drive first, and 2) I figure getting a 24-year-old version of software meant to run on DOS will be an absolute transcending joy to get running on Windows 7 (I may still have PTSD from getting AutoCAD to almost, sort of work on Windows XP).... So, not gonna do it.

I'll ask my friend Liz who uses GIS software every day for work to take the bat to this when next she visits.
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

I got it running on W7 64 bit without much drama. I'll see if I can have another look at it this week and figure out what I did.
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
Just Crazy Jim

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Well, I managed to get a height map for my chosen area, now the problem is figuring out how to get the map editor from turning it into unplayable junk.

If I have it figured right, 1 pixel in the TGA should equal about 1.5 game miles (more or less). That's a burden and a half. At 1 pixel = 1.5 in-game miles, the height exaggeration in the game makes just about everything I've tried so far into absolute crap. I'm sure there's a sweet spot on these settings... I hope....

I tried other scales, resizing the TGA, cropping, etc. But my goal is to come up with a map without 200-mile-tall ridges yet 1-mile-wide rivers... It may yet happen, geography of Wales permitting.
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Yes it's tricky to get something useful.

The map scale (horizontally) depends entirely on what area you choose to crop from the DEM's. The nominal 1.5 miles per pixel, or whatever it is supposed to be, only relates to track units in the ledger. It has no relationship to the actual distances between geographical features on the map.

Getting the map heights to a useful result becomes easier as the map scale increases (ie: as real world area covered decreases) but you'll still probably have to play around with combinations of just about every map height setting available to get it near enough. It's a PITA, but it's all we have.
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

A bit of an update on this. From another thread:
Quote from OilCan:

Google Earth has a very different projection than the GIS maps I create for RT3 games. I tried Google Earth with the Alaska game and could not get the heightmap and images to match up. Google maps, on the otherhand, had a spot on projection which made overlaying them with an RT3 heightmap very easy.

Google changed their maps application sometime last year (maybe 2 years ago?). The newest map application uses the Google earth projection. They left a way to use the 'classical' (earlier) map application as an option. Saddly, they removed that option earlier this year.
Turns out we are once again in luck, for the moment anyway. I found a handy dodge. The USGS EarthExplorer home page has a nifty Google map on it for reference and (this is the good bit) it uses a cylindrical projection for map view and for satellite view. In other words, it is set up so that the projection will automatically match heightmaps taken from DEM's. Various overlays can be toggled on and off, so you can screengrab the area you want and match it up for latitude and longitude. It should only require a bit of horizontal and vertical scaling to make it fit the 1024x1024 demanded by RT3.

_EarthExplorer_default.jpg

There is a bit of a catch, in that the map is inconveniently small. It would be handy if you could grab the entire area in one shot, at a fairly large scale. Turns out you can do that too, if you're a tad cunning. What I did was use Stylus to run some custom CSS in my browser. This alters the page's presentation to make it more useful. Note that it only affects presentation in your own browser. It's quite common practice to do this, and it's not malicious code at all. Anyway, the result looks like this on my monitor...

_EarthExplorer_custom_1.jpg
_EarthExplorer_custom_2.jpg

The blue square in the last shot is 1024x1024, the size required for RT3 map textures. Screengrabs will need scaling for width if you are doing a fairly wide map, but that isn't a big deal. This is going to be very handy indeed. I wish I'd figured this out before I did that Latvia map. *!*!*!

One thing that did occur to me is that anyone using screengrabs from Google Maps or Earth really should be polite and include some attribution. This could be done in any readme files, and added as a postscript to the scenario start dialogues. That way if anyone legally inclined does ever happen to check one of the relevant maps, at least you're trying to be nice. This tends to make people happier than the alternative of not bothering to be nice, so is generally a good idea. (0!!0)

Edit: I just checked more carefully, and although the projection is cylindrical it is not quite the same everywhere. It is the same everywhere horizontally, but as you go north the latitude lines get fractionally close together (by about 0.04 degrees per grid line at the "50 km" scale). This would not be a problem in many cases, but even when it was it would be easy to work around it by slicing the screengrab horizontally and scaling the slices slightly, if you were really worried about getting it as close to perfect as possible. !*th_up*!

PS: The custom code I'm running in Stylus looks like this. The height is sized for my monitor, and can be easily adjusted to fit any other monitor. The width will automatically fit anyway.

Code: Select all

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url("https://earthexplorer.usgs.gov/") {
  #searchCriteriaBox,
  #navbar,
  #mapDisclaimer,
  div.gm-svpc {
    display: none;
  }
  #right-col {
    position: fixed;
    z-index: 999;
    left: 0;
    right: 0;
    top: 64px;
    bottom: 0;
    margin-left: 0;
  }
  #map {
    height: 1052px;
  }

}
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Tried a quick test of the idea. Test map was 1 degree East over to 17.19 degrees East, and 51.45 North down to 45.15 North. The odd dimensions are chosen because one DEM crop is as easy as another, and these proportions catch some key cities while giving equal vertical and horizontal scales. Map size is 768x448, and real life map scale is just over 1 pixels per mile (about 1.03).

I sliced multiple copies of the screenshot at the horizontal grid lines, then scaled them vertically to suit, before merging the slices into one layer and the resizing that to 1024x1024 and saving as a BMP. This was then applied to the map via bmp2gmp, with no further attempt to tidy things up. The match around the English Channel and Adriatic coasts is pretty good. It could be made a bit better without too much trouble (there are various ways to fudge this, none of which are difficult).

Coasts.jpg

I imported the heightmap with 0.5 for overall and mountain height modifiers, and 0 for smoothing. Terrain seems pretty accurate. The alpine lakes from the satellite shot fit exactly where they should, and the snowy peaks appear to be in the right places too.

Alpine_lakes_1.jpg
Alpine_lakes_2.jpg

I've run a quick check on a few cities, and they seem to be good to go as well. Doing it this way is a lot easier than trying to tile things up from Google Earth, so I'm calling it solid proof of concept. (0!!0)
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
User avatar
RulerofRails
Dispatcher
Posts: 310
Joined: Sun Dec 08, 2013 1:26 am

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Just a random thought, the colors on the Google imagery at the level that can be used for an RT3 seem very dead to me. I don't know if it's part of the replacement/combination algorthim or what? When I tried to use the bmp2gmp I ended up finding a still image and using that which required me to do lot of work on the coastlines etc. so not a good solution. I did a quick look around, not comprehensive, but it seems that a lot of the other projections with IMO better colors use cylindrical projection. Even Bing maps.

Here's a little example.

Google maps.jpg

Bing maps.jpg
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

I find that any sat shots need tweaking to work with the available RT3 trees and other factors. Forests always look dark from space. RT3 waves break back from the actual ocean or lake edge (so you get some bare blue sitting around). I expect to do some adjustment of satellite shots to balance things out a bit.

I find the Google colours pretty accurate on the whole, when I check them against places I know the look of IRL. The Bing ones seem more saturated in parts, if you like that look, but I don't think they're necessarily more accurate. For example, the Red Centre of Australia is called the Red Centre because it's red. Heaps of iron oxide in the soil and sand out there, and if you fly over the middle of the country it's just rust red for hours. Google captures that colour pretty well, whereas Bing doesn't (much flatter and more faded). The darker sea in Bing isn't an issue because RT3 will put its own water surface over it, so you can't really tell what the ocean background colour is except near the shore, and it's easy to change if you want to. IMO Google tends to capture the colours near beaches better, rather than jumping directly to dark blue.

The other thing about Bing maps is that you have no idea what the projection is*, because they don't provide any grid. That means if it's out of whack a bit you'll have to fix it by trial and error. I know Google Maps doesn't use cylindrical, because when you zoom out it shows a globe, so it must be using a different projection. Bing also doesn't allow vertical and horizontal scrolling via the arrow keys, so you can't take a consistent strip in any direction. The USGS page allows you to do this.

BTW, the screenshots of the test map were taken just after sunrise. The middle of the day is quite a bit brighter.

*Edit: Decided to use my brain for a change, and did a quick search. https://en.wikipedia.org/wiki/Web_Mercator_projection

So it is a form of cylindrical projection, which is handy, but Bing still don't provide any grid references.
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
User avatar
RulerofRails
Dispatcher
Posts: 310
Joined: Sun Dec 08, 2013 1:26 am

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

You, are correct, Bing isn't a perfect source. I wasn't recommending it as a superior alternative. I just had it up when I was trying to make an illustration.

There are other sources too, also with flaws, such as:
https://s2maps.eu/
has stitching bands

https://zoom.earth
has clouds, but you can access everyday and maybe find a shot without too many clouds.

As I said I didn't look that hard, so there's probably better ones somewhere.


The saturation is a matter of taste. But that could also be adjusted.

Google does do the deserts well. However, the thing is that it's not very realistic to have a sprawling railroad in the middle of the desert. Realistically, how many maps are we going to make in the Sahara, Gobi desert, etc.?

For all intents and purposes the places where people live tend to have seasonal changes in vegetation. Whether this is natural as in a summer/winter or a wet/dry, or man-made as in crops planted/harvest etc. an average in my opinion just doesn't look right.

This is what I am meaning with Google. Obviously they aren't too concerned with this level of imagery. I'm guessing that their algorithm averages the coloration of vegetation throughout the entire year. This seems to bleed green into almost all colors where there is any vegetation. At any particular point in reality I think that if the season is right there will be darker shades of green where real vegetation is and definitely more bare ground especially in dry/winter seasons which would be more brown tones. Or maybe it's just me? :roll:
Post Reply