LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod

Author Topic: drunk's Cheap and Cheerful MapTutorial  (Read 7653 times)

0 Members and 1 Guest are viewing this topic.

Offline dobdriver

drunk's Cheap and Cheerful MapTutorial
« on: March 01, 2013, 07:06:10 AM »
G'Day Devotees,

This post will be split off into a new thread when I return home next month, I will continually add to this post as it is the beginning of my Make High Quality 16bit Scale Maps For Free or Very Cheap Tutorial With All Bits In One Place.

One word of note one shouldn't be bored when undertaking this project (those who state "I was bored and made this map." it shows).

Today's episode will not have any pics for the time being (been a bit busy) but I will add them in later.

What do we need for this: 1. A GIS program to convert data. 2. An editor to manipulate data. 3. Something to capture larger than screen size google images. 4. Mapper. 5. Terraformer. 6. Manager. 7. And lastly we need DEM data.

1. QuantumGIS probably does many things including making coffee but we only want it to convert our file formats. One can download it here. 3dem is a handy free gis program and can be downloaded here.

2. Good editors that handle 16bit images are few and far between, free or cheap ones are nigh on impossible to find. I found this while working with Izi as he did not have photoshop, it is not freeware but shareware and at 59 euros is a bargain. Photoline can be downloaded here.

3. I used to drag all over and capture google map images in my browser then Izi said "I found this give it a try." Talk about a time saver, Google Map Saver can capture images up to 12000 pixels square and save in a variety of formats.

4. Wouanagaine's SC4Mapper, Get it  here.

5. Wouanagaine's SC4Terraformer, Get it here.

6. To get the full region image everyone seems to quote Region Census, then most complain it crashes or doesn't manage the large regions. I've always used JeanLucPicard2's SC4Manager and never had a problem irrespective of region size (including the monster Cornwall/Devon map). You can get SC4Manager here.

7. The last piece of the puzzle is dem data. There are a variety of places to get dem. SRTM 3 second data can be had from the tradesman's entrance, this is what I use for the rest of the world excluding Australia and the US. For Australian one second dem go here, one is required to register and log in to download data. I bought it before it was available on the etherwebby and it is in esri grid format. US data can be downloaded with this, it is the best little find that I made. The data comes in whole degree tiles, get the arcgrid as I don't know if quantum supports flt files.

Okay by now one should have downloaded and installed the goodies on one's machine. Let's get into the nuts and bolts. I will make a map of Eureka in California for this tutorial. It is situated at about latitude 40.80 North and Longitude -124.16 West. It will require 2 tiles and I will use 1/3 second DEM, one will be a float file and the other will be an arcgrid file, normally I use Arcgrid files. These are the two main types now available on the the silly server.

Collect the DEM

Open the NED page in a browser and input into the bottom and top Lat: 40 and 41, and into the left and right Lon: -125 and -123.

The minus sign is necessary as it only serves DEM from the western hemisphere, if the longitude is less than -100 then a zero is required: -0xx. These will take a little while to download as the server is not overly fast. Here's some I prepared earlier.

Save the two zip file to a directory on your hdd and extract using folder names. With NED data there are a lot of common named files so the folders cannot be mixed unfortunately.

Readying the DEM
This section deals with converting and if necessary merging the DEM into a format that we can use.

Start QuantumGIS, it would appear quantum is a frontend for a lot of command line tools and as such we do not have to load any of the files into it.

From the menu click Raster>Conversion>Translate (Convert Format)

and in the dialogue click Select and navigate to the first dem file and select it.

All ArcGrid files are named w001001.adf, ensure Files of Type: is [GDAL] All Files (*)

Click Select next to the Output file and navigate out of the DEM folder, name the file and choose GeoTIFF. One can see my directory hierarchy in the pic. Click Save, then click OK in the dialogue.

A confirmation will pop up and a warning which can be disregarded.

That is the first DEM converted.

Follow the same procedure to convert the second DEM to GeoTIFF. This time I am using a flt file but a good habit is to only use the same file formats.

Float files give no warnings ;<)  Click Close.

Now we have to merge the DEM into one file.

Click Raster>Miscellaneous>Merge

Click Select and choose the two GeoTIFFs then click Open.

Click Select next to Output file, name it and choose GeoTIFF as file type.

Click OK in the dialogue, a confirmation will pop up, click OK and close the dialogue.

Close Quantum.
We now have a monster GeoTIFF file of huge proportions to cut our map from and is ready for the next phase.

Sizing the map

The next phase is to size the DEM and cut the map, for this we will use photoline.

Start Photoline and click File>Open, navigate to your directory containing Eureka.tif highlight it and click OK.

It will be a HDR image and these appear to be mapped from full black to full white in photoline, that is ok but it will highlight a terraformer bug (luckily I found a work-around) ;<)

Latitude is constant (or fairly constant) over the entire globe and the accepted figure for 1 of latitude is 111.325km and is equivalent to 6958 pixels in SC4 terms. This can be worked out mathematically as:

111.325 x 64 / 1.024 = 6957.8125

This can be rounded up to 6958. The final divisor 1.024 is to account for the fact that city tiles are not 1km, 2km and 4km but 1.024km, 2.048km and 4.096km.

Longitude unfortunately is not constant over the globe and varies from 0km at the poles to 111.325km at the equator. Lucky there is a simple formula to find the longitude at any given point on the globe and can be expressed thus:

Where latitude = aa
cosine aa (x) 111.325 = longitude aa

For SC4 using Eureka's latitude of 40.80, we have.

Cosine 40.8 x 111.325 x 64 / 1.024 =   or
Cosine 40.8 x 6958 = 5267.1715972249212060011484599633

Now we have two tile wide so we multiply by 2 for a figure of 10534.343194449842412002296919927. I think we'll round it down.

The built in calculator in windows has scientific functions, click View and choose scientific. Input the latitude before clicking cos.

Anyhow we now have some figures to resize the image to.

Click Layer>Scale Layer in the menu.

In the dialogue for Mode: choose Formula, for Interpolation: choose Bicubic, input the width and height figures we previously worked out of 10534 and 6958 and lastly click OK.

The map is now accurately scaled in latitude and longitude for Eureka, every map one makes need to be scaled in longitude accordingly to it's latitude.

Cutting the Map

With the image being so dark we will stretch a layered copy to help us cut our map.

On the right are some palettes, in the Layers/Channel palettes right click the image (not the eye or the tick) and select Duplicate Layer from the menu.

Still in Layers/Channel palette click the top image, The tick will move up to show it is the working layer.

Click Tool>Histogram Correction

In the Dialogue drag the middle caret to the left until Gamma is about 3.5, This will brighten the mid-tones considerably. Now drag the black Output Levels slider right to about 20%, this will lighten the shadows. Click OK.

Zoom in and out with the mouse wheel (very handy). the focus will be to the cursor.
It will be small at 8 x 8 tiles so we will cut a 2049px x 2049px map

Select the Crop Tool from the left hand side and make your selection, remember the map is only accurately sized for Eureka and it is situated between the two lagoons near the top of the map. When you are happy withe the selection press Enter on your keyboard to crop the image.

Click and drag the green carets to resize the selection or position the cursor inside the selection and click and drag to move the whole selection.

On the right and in the Layers/Channels palette right click the top image and select Delete Layer.

Click File>Export>Export

In the dialogue select PNG as Type and click Save.

A warning will pop up about the drop from 32bit to 16bit, click Yes.

Making a config.bmp

Click File>New>New Picture

In the dialogue input 32 and 32 in the size boxes and click OK.

Select the colour chart choose blue from the top row.

Select Flood Fill from the left hand side and click inside your image.

Press Ctrl+S and in the dialogue name it config and click Save.

Close photoline,
Do not save changes to Eureka.tif as one may want to make other maps from it.

The map is now sized in two dimensions and we have a config.bmp

Setting the elevation

Start Terraformer, in the dialogue navigate to the directory with the map config.bmp and click OK.

Click OK in the next dialogue.

In Global Tools click Import Image and in the dialogue that opens click ..., Navigate in the pane to the map image.

This is how it opens (Don't Worry)

Click Compressor and in the dialogue input 255 in Max Height Will Map To.

This is to find the highest point of the map.

The map now looks thus.

I have marked the high spot with a red circle.

Open your browser and open google maps. Zoom into Eureka (West Coast, north of Fort Bragg) and switch to terrain view. When we have found it (Lat: 40.638902 North, Long: -123.937798 West) zoom in to full extent to read the height. American topo maps are in feet and it is 40' between contour lines. Our point is over 2,920' and is quite steep. We'll call it 2,935'

This figure can be converted in the calculator to metres and is equal to  894.588m.

Click Compressor and input 250 (Sea Level)into Min Height Will Map To and 1144.588 (Add 250 for Sea Level) into Max Height Will Map To. Click OK.

Click Export (SC4M/16bit png) and in the dialogue name it (overwriting the old file at this time is fine), choose 16bit png files (*.png) then click OK.

Click OK in the confirmation pop up. Close terraformer. Do not save modications or else the directory will be flooded with files!

We now have a map scaled in length, breadth and height.

« Last Edit: March 01, 2013, 09:13:45 AM by dobdriver »
Need a map? Check these Beauties out.
Check out my Stex, Lex and PLAN B uploads.
What about YOU make a map? Use my easy to follow Tutorial.

Offline dobdriver

Re: Drunks Cheap and Cheerful MapTutorial
« Reply #1 on: March 01, 2013, 07:07:14 AM »

And Now For Some Water

Start google map saver and to begin with untick Info on Start then click about and accept the terms. (This will stop the google address splash being marked on the image), I've clicked it about 50 times and the 'puter hasn't blown up yet. Close map saver and re-open it.

Under Resolution choose one, I use 12000x12000 (previously I used 10000x10000 as I got out of memory pop up, I have since patched it with the 4GB patcher and no trouble since). Under Zoom choose 15, this is a good middle range with plenty of detail. Under Map Type choose Satellite. Next to Save Capture As choose BMP (I normally use TGA but unfortunately photoline does not open map saver's version of TGA). Under Location/POI input the lat and long for the map. Click GO!

You may get a pop up on 12000x12000, make sure to click No.

Once it has finished capturing the image Click Save Capture As, name it and click Save.

At 12000x12000 pixels one image is sufficient for this map.

Close map saver.

Now The Fun Starts

At this point I fire up photoshop as i have been using it for a long time and while no expert I am very comfortable with it's tools and layout now. This next section is all 8bit work and I will show and describe how to do it with photoline although for me it is also a learning procedure. If you use another editor usually and are comfortable with it, feel free to use it for this section. We are going to capture the water with the lasso tool, it is a simple operation but can be long and tedious. this map only being small it will be fairly quick.

As we have already noted Photoline will not open the tga files produced by google map saver but it will open and save tga files from other sources, I have also discovered that the layered tif files produced by photoshop only open as flattened images in photoline and vice versa, the same could be possible with other editors and layered files may open flat. I will show how to recover the image if you use a different editor and this occurs. just ensure to save it as a layered tif.

Start photoline and Click File>Open, Select the water image and click Open.

Select Crop and trim the image ensuring to fully cover the map image. Press enter on the keyboard.

Some handy shortcuts to remember: Scroll Wheel - zoom; Space Bar - hand (Press and hold Space Bar then click and drag image) .
The Lasso works a little different to what I am used to. Use shift and ctrl to add to and subtract from the selection. Releasing the left mouse button does not automatically close the selection, double click or right click will close the selection. Save often, you don't want a catastrophe to lose your hard work.
Select the lasso, and get ropin'

Toggle the Show/Hide Mask to turn off the garish green, it is the blue highlighted icon below the tools palette. Don't forget to save! Often!

To save, on the right in the Layers/Channels palette right click Water Background and select New Layer from the menu. Select Type: Gray Image and tick 16 Bit, click OK in the dialogue. This is important as the colour in photoline is only 8bit but the histogram works in 16bit.

On the left in the tools palette right click the colour rectangle and choose edit from the menu, select Gray from the drop list,set the shade to 3.9% and click OK.

Select the paint bucket and click the image, it will paint the selection. The title says it all, it is a colour image with a 16bit grey layer.

Click File>Save As and select TIF Image as the type, click Save.

We use tif because bmp cannot save layers and it is important to keep the water mask as a separate layer. Continue lassoing and saving until all the water (sea, rivers, creeks, lakes and ponds have been masked.

When saving for a second, third or fourth time etc, delete the top layer then make a new layer as paint bucket can have odd effects in already coloured selections.

If you do not finish it in one sitting, save it per the above instructions and when you open it again it will be all there. We will use the automask to re-select our painted portion then the lasso to extend it.

If you used a different editor and when opened in photoline it was flat. Select the automask from the tools palette and on the right is the Tools Settings palette.

Set the Tolerance to 1, un-tick the three boxes and click the water in the image. You will now be able to paste that into the map image.

I will leave it here for the time being as I head to work in the morning. Remember, Git Lassoing.

It is a quick section to write but takes the longest to accomplish.

Layering the Water

With photoline still open click File>Open, select Eureka.png and click Open.

On the right in the Layers/Channel Palette right click Eureka Background and choose Duplicate Layer.

Click Tool>Histogram Correction, or press Alt + L on the keyboard

and set the three carets thus:

And again.

One last time.

This is so we can see what we're doing, this stretched layer will be removed later.

Click File>Open and select Water.tif, then click Open.

Ensure the water mask layer is highlighted and that squiggly blue highlighted thing is not. Press Ctrl + C to copy the mask

Click Eureka.png and press Ctrl + V to paste. Scroll to zoom out to see the extent of the water mask over the map.

The black square is the map.

We will use the green sliders to scale the water to the map. The corners move diagonally while the top and bottom move up and down and the sides move left and right.

To unhitch the snap function (jumping to borders) Click View>Alignment Helpers>Align to Grid.

The water aligns okay but there does appear to be very few transform commands in photoline compared to photoshop, sometimes the images are warped and need a little unwarping while transforming. This may not be achievable in photoline.

Save the map image and water as EurekaWater.tif to preserve the three layers as png's do not support layers. Our map is almost complete, so stay tuned.

I need to find some more commands in photoline! Okay, so searching for various things I came across very little.

At 3.9% grey the water level is 230m a little too deep, at 4.0% the level is 257m. Sir I think we've run aground. We will use the histogram to make the water shallower.

Press Alt + L to bring up the histogram dialogue and set the middle caret to 1.02 (midtones). Click Ok. The water level is now about 246m.2px

Select the Automask from the tools palette on the left and click the water layer.

Click Tool>Mask>Contract Mask and set Contract By: to 2px. Click OK.

Press Alt + N to make a new layer. Gray Image and 16 Bit.

Now select the paint bucket and flood fill the new layer with the same shade of grey, 3.9%.

This last piece comes courtesy of our old mate Izi who was working quite extensively with photoline and unlocked the only hidden gem. While it is quick and dirty and relatively coarse compared to my normal method, it will suffice. With photoline lacking tools such as feather or perhaps hidden in strange names this will do at a pinch.

Click Effects>Layer Style>Inner Blend.

In the dialogue set the carets like thus and use the Proof button to check the results before clicking OK.

In the Layers/Channels palette Set the blend of this layer to multiply and the intensity to 50%

Still in the Layers/Channels palette right click the stretched map layer and select Delete Layer.

Then right click the bottom background layer and select Reduce to Background Layer.

Press Ctrl+ Shift + S and save as EurekaWater.png.

Close Photoline.

Start Terraformer and import the map, we see the groynes and some of the islands have sunk and some of the creeks have dried up a little.

We will use the Zone tools Make Hills to raise the islands and groynes and Make Valley to depress the creeks. Set the Radius to 2 and the strength to 2. Go slow and there is 1 undo in the configuration Tools. If it gets right out of shape, don't save just reload the map.

Last job is to stretch the sea deeper. Click compressor and set min height will map to: to 66, set unchanged value: to 250 and leave max height as is.

Click OK.

Oops looks like I have run out of piccie space.

Click Export and make an sc4m file of the map.

That's it, job's done. While the coasts are a little bit squirgly compared to my usual fair, I am sure a little bit of experimentation in photoline would sort it out.
There are a couple of items for the addendum to be added.

Well that will do for today. Thanks for looking and have a great day.

« Last Edit: March 01, 2013, 07:13:43 AM by dobdriver »
Need a map? Check these Beauties out.
Check out my Stex, Lex and PLAN B uploads.
What about YOU make a map? Use my easy to follow Tutorial.

Offline dobdriver

Re: Drunks Cheap and Cheerful MapTutorial
« Reply #2 on: March 01, 2013, 07:15:06 AM »
Need a map? Check these Beauties out.
Check out my Stex, Lex and PLAN B uploads.
What about YOU make a map? Use my easy to follow Tutorial.

Offline dobdriver

Re: Drunks Cheap and Cheerful MapTutorial
« Reply #3 on: March 01, 2013, 07:15:28 AM »
Need a map? Check these Beauties out.
Check out my Stex, Lex and PLAN B uploads.
What about YOU make a map? Use my easy to follow Tutorial.

Offline dobdriver

Re: Drunks Cheap and Cheerful MapTutorial
« Reply #4 on: March 01, 2013, 07:15:50 AM »
Need a map? Check these Beauties out.
Check out my Stex, Lex and PLAN B uploads.
What about YOU make a map? Use my easy to follow Tutorial.

Offline dobdriver

Re: Drunks Cheap and Cheerful MapTutorial
« Reply #5 on: March 01, 2013, 07:16:09 AM »
Need a map? Check these Beauties out.
Check out my Stex, Lex and PLAN B uploads.
What about YOU make a map? Use my easy to follow Tutorial.