Harrisburg, PA - Creation

Well, where to start... I guess it's best to figure out the location and approximate region size that I'm looking to create. The Harrisburg PA area holds a good bit of interesting geography that should be interesting to build on. We've got the Susquehanna River (which is a decent width when it passed Harrisburg and has a few small islands such as City Island and TMI) and the Blue Mountains on the north side of the city which act as the other natural boundary.

Lay of the land

First step was to snag a map that had a kilometer distance scale of the area.

Harrisburg PA Atlas Map

The problem with using a real world compass alignment though is that the major bridges that cross the Susquehanna at or near Harrisburg don't cross in a pure East-West direction (I-83 for example). SC4 currently isn't able to place bridges diagonally across bodies of water, so I'm going to have to turn the map to make the key section of the river fit either the North-South axis or the East-West axis. Here's what I think the "turned" alignment is going to be, rotation is 35 degrees clockwise (the shaded boxes are 16x16, 20x20 and 24x24 km areas):

Harrisburg PA - Rotated 35 degrees clockwise.

Aerial photo:

Harrisburg PA - TerraServer

You are here

So now I have a general idea of what the boundaries of the region are going to be (24x16 km). Boundary points are going to be places like Perdix, Middletown, Lewisberry, Wertzville, and Dauphin. Since DEM works off of latitude/longitude, I need to find out what those corner points are. (I'm pretty sure that I can do this with TerraServer, which is a fun web site in and of itself.)

Getting the DEMs

So now to puzzle my way through using ATDI's free DEMs (click on the DOWNLOAD FREE SDTS DEMs link). I started by plugging in the location of City Island (Lat +40.26, Long -76.89), which gave me the following file link:

1699795.dem.sdts.tar.gz (2471 kB)
Spruce Hill, PA. Resolution 10x10 M, heights in 0.1 M, NAD27.

You'll need a program that can handle DEMs (such as MicroDEM which is free and a 30Mb download) and a program that can open .gz files (such as WinZIP).

Contents of the DEM archive file

Directory of C:\Webs\Games\SimCity4\Regions_Design\Harrisburg PA\DEMs\1699795_dem_sdts
1 KB  8/29/2001 1014CATD.DDF
2 KB  8/29/2001 1014CATS.DDF
6123 KB  8/29/2001 1014CEL0.DDF
1 KB  8/29/2001 1014DDDF.DDF
1 KB  8/29/2001 1014DDOM.DDF
1 KB  8/29/2001 1014DDSH.DDF
1 KB  8/29/2001 1014DQAA.DDF
2 KB  8/29/2001 1014DQCG.DDF
4 KB  8/29/2001 1014DQHL.DDF
1 KB  8/29/2001 1014DQLC.DDF
3 KB  8/29/2001 1014DQPA.DDF
1 KB  8/29/2001 1014IDEN.DDF
1 KB  8/29/2001 1014IREF.DDF
1 KB  8/29/2001 1014LDEF.DDF
1 KB  8/29/2001 1014RSDF.DDF
1 KB  8/29/2001 1014SPDM.DDF
1 KB  8/29/2001 1014STAT.DDF
1 KB  8/29/2001 1014XREF.DDF
2 KB  8/29/2001 README
19 file(s) found, Total file size 6,148 KB

Reading up on using MicroDEM

While that 30Mb installation is transferring, I did some searching for articles dealing with MicroDEM. Since good articles exist, I'm going to gloss over the step-by-step bits and just go straight for the results.


Details, details, details

First off, the area that I selected for download was (39.997936 N, 77.155186 to W 40.521256 N, 76.482491 W) which is larger then my final region size by a good bit. I did go back and use the USGS Seamless site tool becaus I'm working with an area that is larger then the size of a single DEM from ATDI (and I'm not ready to stich DEMs together). The process of getting a DEM "pack" from the USGS web site was pretty simple - it's all point and click, just follow the directions that Rybolton wrote up and you'll have a nice large TIFF with the data you'll need. Opening the downloaded DEM into MicroDEM wasn't too difficult, except that I had to use File > Open DEM and then change the Files of Type: drop-down list to Geo TIFF. So now I have my DEM data and I need to convert this to something else...

MicroDEM - Harrisburg PA area (the image has been intentially re-sized down to fit the webpage and there was no need to make it larger).

Now, use the Modify > Map Area > 1:1 View to change your zoom level. The Info menu choice in MicroDEM will now give you the number of sampling points for each of the axes. Since we don't care about true north issues, or 100% military-grade accuracy, we can ignore things like datums or that a data point may not represent a square, MicroDEM will figure all of that out for us. Notice that the number of samples in the North-South axis does not match the number of pixels on the screen (because a sample isn't square). The map that I'm currently working with has the following statistics:

Pixels - 2422 x 2467 (37.02m per pixel)
Samples - 2423 x 1885 DEM points, 1.31 points:pixel ratio
Size - 89.66 km x 91.328

This is a rather large map to work with, so plan on having a bit of patience as MicroDEM recalculates things (memory requirement is only ~60Mb at the moment, so it's CPU-bound). Hmm... attempting to show a 1m spacing grid was a bad choice (time to go kill off MicroDEM).

Something to keep in mind is that our target resolution for the grayscale height map is 1/64 km per pixel (or 15.625m). Since I'm going to have to rotate the image 35 degrees in order to get the alignment that I want, I'll be shooting for a resolution of 1/128 km per pixel (7.8125m) and then sizing down ~50% to get my final image size. So I need to change the zoom factor on MicroDEM to be 7.8125m by using the Modify > Map Area > Custom Image Size tool. (89,660m / 7.8125m) equals 11,476 pixels and (91,328m / 7.8125m) is 11,690 pixels -- which is going to be a 128Mb grayscale image (a bit large to work with unless you've got gobs of memory). Since that seems a bit large - I'm going to work with a 1/64 km per pixel resolution for the moment (5738 x 5845 pixels) until I know what I'm doing.

MicroDEM took a minute or three to change the scale to 15.625m resolution and memory usage jumped to 228Mb. I was also no longer able to scroll vertically to see the entire area (bug or limitation?). Checking the Info menu item again gives me the statistic that the resolution is now set to 15.62m per screen pixel, which is exactly what I wanted. Pressing onward, I used File > Save map as GEOTIFF. The resulting image file was 100Mb.

Quick summary for using MicroDEM:


  1. File > Open DEM, change Files of Type: to Geo TIFF, select your downloaded DEM TIFF
  2. Modify > Display Parameter > Elevation (changes the display to elevation data instead of a false-composite aerial view)
  3. Modify > Elevation > Colors, Choose Gray Scale from the list
  4. Modify > Map Area > Custom Image Size, enter the resolution that you want (for me it was 5728x5845 for a 15.625m resolution image)
  5. File > Save map as GEOTIFF

Rotating and cropping

Some folks use Adobe Photoshop, however those of us who live on a budget and want the power of Photoshop without the price use JASC's PaintShop Pro (PSP is about a third the cost of Photoshop).

As I mentioned earlier, I'm not interested in a purely North-aligned image because I want the river bank in the City Island area of Harrisburg to parallel SC4's North-South axis. To do this means I have to rotate the image 35 degrees clockwise. Then I have to select a 24x16 km area and crop the image down to a more manageable size. BTW, to work with image files that are 5000x5000 pixels requires around 1Gb of memory unless you skip the undo ability, once you run out of physical memory everything gets painful to work with.
  1. Image > Rotate, 35 degrees to the right (skip if you don't need to rotate)
  2. Colors > Increase Color Depth > 16 Million Colors (24 bit) (skip if it's already 24 bit)
  3. File > New, create a new image that is 1025 x 1537 pixels, set the background color to Red (this is if you want a 24x16 km region)
  4. Edit > Copy to place the red rectangle on the clipboard
  5. Switch back to the DEM image, Edit > Paste > As New Layer
  6. Layer > Layer Properties, change opacity for the red rectangle layer to 25%, move the rectangle around until you have the area covered that you want
  7. Grab the Magic Wand tool, click inside the red rectangle and it should select the area covered by the rectangle. (If not, verify that you're on the correct layer and that the tool options are properly. Match mode: RGB Value Tolerance: 10 Feather: 0)
  8. Image > Crop to Selection
  9. Layer > Layer Properties, un-check the Layer is Visible box
  10. Colors > Greyscale, switches back to 8 bits per pixel
  11. File > Save As, save your image out as a JPEG, BMP, or PNG (choose Yes to save the output as a merged image)

Importing into SC4 (first test)

Even though I'm not done at this point (e.g. I know that elevations are going to be messed up, I didn't do the water finding portion, etc.), I went ahead and created my config.bmp to be 16 x 24 with all large city tiles.
  1. Create a new region in SC4
  2. Exit out of SC4, copy the new config.bmp file into the new region folder
  3. Start up SC4 again, choose the new region, and press Ctrl+Shift+Alt+R
  4. Go have lunch... or a nap... or a walk around your real-world city... or a trans-atlantic flight (maybe trans-pacific)... (I started my import at 9:15am and it finished at 9:20am on an AthlonXP 1800+ for a 24x16km region).
Hmmm... it looks pretty ugly, very choppy (but I think there was something strange about the image file that I created). Also, everything is pretty much underwater because I didn't fix that problem yet. So I saved out the height map as a PNG file and restarted the terrain import at 9:40am (finished at 9:45am). Ah... that looks much nicer (although most everything is underwater still and the heights are off).

First attempt at loading a height map into SC4. First attempt at loading a height map into SC4.
First attempt at loading a height map into SC4. First attempt at loading a height map into SC4.

MicroDEM - round 2

Now that I have a better idea of what the bounding area is going to be for my region, I went back to MicroDEM and used the subset/zoom tool to cut down the map size by as much as possible. This gives me an area that is:

Pixels - 1098 x 1085 (36.56m per pixel)
Samples - 1099 x 829 DEM points, 1.31 points:pixel ratio
Size - 40.14 km x 39.67 km

Since the file size is so much smaller, this time I'm going to go ahead and work with the 7.8125m resolution per pixel setting, which gives me an image size of 5138 x 5078 -- (40,140m / 7.8125m) and (39,670m / 7.8125m). Which I then changed to a grayscale elevation map (and I turned on interpolation but didn't bother with lake/ocean check). I saved out a few different versions as shown here. The first (2) are the grayscale level maps - the one on the left is a non-interpolated version (notice the blockiness) while the one on the right was interpolated to give a smoother result. The second two are just the initial "fake" aerial mode that MicroDEM defaults to and the colorized version of the elevation model.

Grayscale levels - non-interpolated DEM samples. Grayscale height map - interpolated
False aerial view (the default view for MicroDEM) Colorized elevation map.

While I did use the magic lasso tool to snag the majority of the main river, I found it useful to go back and add additonal areas to the river basin by hand (or to tweak the auto-lasso'd shoreline). Editing a 5000x5000 pix 24 bit image is a bit rough on the ol' system (especially when I had 4 layers going). Looking at the raw grayscale, the "deepest" portion of the river has a value of 17, while in the north part of the map, the river has a value of 28 (thus shorelines have a value of 29+ in the north part of the map, and 18+ in the south part of the map). From what I've seen in one of the articles, SC4 places any pixel with a grayscale value of 61 or less underwater.

So now I get to put on my thinking cap and try to figure out how to boost shore line altitudes to a base brightness of 62+ and scale the rest of the values so that SC4 creates the proper height mountains. The altitude of the international airport southeast of the city is 94.5m (grayscale value of 24/25), while the smaller airport just southwest of the city is at an altitude of 105.8m (grayscale value of 29/31). These values are also available using MicroDEM... the surface altitude of the river just north of the city is 91m (rising to 97m up around Duncannon. Down by the international airport, surface water is only 85m. Now in the grayscale image that I exported, these spots are value 23 and 20. On the mountain range just north of the city, I have one peak that is 400m with a grayscale value of 183. This gives me 163 grayscale values, representing 315m of altitude (or 1.93m per grayscale value).

To convert to SC4's coordinate system, I need to figure out what the vertical scale of the import feature is. Looking at the terraforming inside of SC4, if you take a city and use the Raise Terrain tool to the Nth degree (56 times to be exact) you'll see that a 2x2km city tile starts to look like a perfect cube. That means that the maximum altitude difference for a city tile is 2km vertically, divided out by 256 gives us 7.8125m per vertical unit. Starting from a maximumly lowered terrain, it takes 6 clicks of the Raise Terrain tool to get back to sea level, and another 56 clicks to get to maximum elevation (which gives us 63 different settings for the altitude or 0..62, with sea level being value 6)

What's interesting is that I'm not really coming up with numbers like 81/256 or 63/256 as being the sea level altitudes (numbers that I've seen bandied about)... instead it seems like if the deepest water is level 0 (-250m) and the top mountain would be a value of 255 (+1750m), then sea level should be value 32. It's possible that there is something in the region.ini file that controls this, but I'm working with defaults currently.

So, back to the program.... I need to push all of my grayscale values around in the height map so that the value of 23 ends up as 31 and the 20 ends up as 28 (giving me a river depth of anywhere from 7-28m). The spot that is value 185 (+400m) needs to end up as value 83. In PSPv6, I think this is done using the Colors > Adjust > Levels tool. I set the channel to RGB, the input levels at 21 / 1.00 / 183 and the output levels as 31 / 83. Looking at the results, I did indeed get the values that I wanted in the spots that I wanted, then using the river overlay (a 15% transparent layer with the river/water areas colored black) I was able to fine tune the value of water down to the 27-30 range.

Rotate it 33 degrees to the right again, create a layer with the 24x16 km bounding box (which is 2050 x 3074), crop the results, and save it out as a grayscale bitmap.

Okay, who ordered a water logged hamburger?

Hmmm, it ended up as a flood plain instead. Soooooo... time to throw a gradient height map at it, where one end of the bitmap is black and the opposite end is white. That should give me a better idea of what sort of height values SC4 is looking for.

24 km by 16 km heigh map - 0 to 255 level gradient map
24 km x 16 km gradient height map test 24 km x 16 km gradient height map test

Hmmm... very interesting (and now I see why a number like 81 was thrown out there). There are 6 4x4km tiles on the long-axis of my region, and the water starts at 1/3 of the way across the region (or 256/3 which equals... 85.33333). So that gives me my base sea level value (which now matches what I've seen posted in the article "Creating new regions in SimCity 4". The other interesting thing is that you cannot import bitmaps and get maximum height mountains, instead the maximum height above sea level for an imported height bitmap seems to be 667m (1km above the base sea floor).

Back to my original grayscale image then... this time I'm setting the values for the Colors > Adjust > Levels tool as channel to RGB, the input levels at 21 / 1.00 / 183 and the output levels as 85 / 187. I then mixed in the black river/water layer at 10% to drop water tiles down to grayscale values of 75-78. Then rotate, create the bounding box, crop it, scale it down 50% (since I'm working double-sized) and save it out as a grayscale bitmap again.

See the Downloads page for links to the finished height maps.

Source Links

  • ATDI - ATDI is a company that designs, develops and commercialises services and software covering the main areas in the design, planning and use of radio networks operating in a range of frequencies from 30 MHz to 100 GHz. However, for our interests, it's because they have a convenient link to the DEM data from the USGS.

  • Creating new regions in SimCity 4 - An article on SC4Ever by Ocean Quigley that covers the process of creating a customized terrain by making a greyscale bitmap and importing it into SC4. (This is the article that sets forth the measurement that a small city tile in SC4 is 1x1km, medium is 2x2km, and large is 4x4km.)

  • J's Instructions for using DEMs - J was kind enough to e-mail me detailed instructions for how to convert DEMs to something that SC4 can use.

  • MicroDEM - A program for working with DEM files.

  • Spatial Data Transfer Standard - SDTS home page (USGS), including links to other sites that allow you to download free DEMs

  • Forkboy's SC4 Terrains - The best-known site, including guides to using DEMs.









Copyright 2002-2003, Wuphon's Reach, All Rights Reserved -- wuphonsreach[at]yahoo.com
SimCity and other trademarks are the property of Electronic Arts Inc. Game content and materials copyright Electronic Arts Inc. All rights reserved.