Planetside Software Forums

General => Terragen Discussion => Topic started by: Tandem on December 26, 2010, 07:48:21 PM

Title: GeoTIFF Dataset Workflow
Post by: Tandem on December 26, 2010, 07:48:21 PM
Good day everyone  :)
I have been lurking around for a few days and it looks like a great forum with a lot of knowledgeable and friendly users.  Now I am ready to ask some questions:
Here is a little bit of background  to the above questions.

I would like to create some 3D elevation models of areas around New Zealand.  After literally chocking Sketchup (SU) while trying to work with terrain data imported through the SU interface with Google Earth, I started my search for a more suitable program for modeling terrain using real world elevation data and that is how I came across Terragen 2.

After reading the TG2 User Guide and going through the Creating Your First Scene tutorial I was hooked and ready to get a license.  However, before I commit myself I need to figure out how to properly load and use elevation data in TG2.

From reading a lot on the Planetside forum and from the product description page, I understand that GeoTIFF is the preferred elevation format to use with TG2.

To test the process I downloaded the Mount Ruapehu GeoTIFF (http://www.linz.govt.nz/topography/topo-maps/map-chooser/singleview.php?xPos=11791&yPos=9489&scale=2&extent=0-BJ34) file from Land Information New Zealand (LINZ)

Then I started a new project in TG2 and created a terrain using the Add Terrain > Heightfield Load command.

TG2 loads the GeoTIFF file without any errors, but the resulting terrain does not look anything like I would expect (see attached images.)

I am totally new to TG and don't know much about Georeferencing so I am pretty sure I just missed some steps or settings, I hope so anyway.

I did read Ryan Archer's Blending Terragen 2 with GIS Data (http://www.archer-designs.com/tutorials/terragen2/working-with-gis-data/index.html) Tutorial, but could not find anything related to my problem.  I am sure I will use it later when trying to work with my imported terrain data later on.

Please, would someone point me in the right direction.  Thank you very much in advance.

Link to LINZ specification of the provided GeoTIFF file format (http://www.linz.govt.nz/topography/topo-maps/topo50/digital-images/index.aspx).

Satellite view of Mt. Ruapehu
(http://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/MtRuapehu_23oct2002.jpg/300px-MtRuapehu_23oct2002.jpg) (http://en.wikipedia.org/wiki/Mount_Ruapehu)
Title: Re: GeoTIFF Dataset Workflow
Post by: jo on December 27, 2010, 06:41:27 AM
Hi Tandem,

I think the problem here is two-fold. First off, I'm not sure the LINZ GeoTIFFs have elevation data in them. I live in NZ and downloaded some of the LINZ GeoTIFFs of my local area to check out and got similar results. I've just been experimenting with a few different GIS apps, most luck using SAGA, and that doesn't seem to want to load elevation data from the files, only the colour image data. Experimenting with GeoTIFFs known to have elevation data works though.

My guess is that the LINZ GeoTIFFs only contain georeferencing information. That's kind of bizarre considering what a large download they are versus the map sheet TIFFs!

The second problem is that I don't think TG2 can load elevation data from GeoTIFFs. I should know for certain, but hopefully one of the others can confirm this. However looking at the code certainly suggests this. Moreover it seems as if TG2 can only load georeferencing data from .tfw files accompanying the TIFFs and not from information embedded in the TIFF file. We should look into improving this.

Right now your best to get GeoTIFF elevation data into TG2 might be to import it into some other app which can export the data as a 16 bit SGI file, or one of the supported DEM formats such as ASCII DEM.

Regards,

Jo
Title: Re: GeoTIFF Dataset Workflow
Post by: cyphyr on December 27, 2010, 09:45:11 AM
3sec arc data is available from SRTM Worldwide Elevation Data (http://srtm.csi.cgiar.org/) and this loads fine into Terragen. You will need to rescale and move the geotiff to 0,0,0. This may be too low a resolution for you but the data is free and might be a good place to start
Richard
Title: Re: GeoTIFF Dataset Workflow
Post by: RArcher on December 27, 2010, 03:14:29 PM
The problem is exactly as mentioned by Jo.  The GeoTiff file you referenced does not include any height information, it is simply a Geo-referenced .tiff image.  You can find New Zealand DEM data here (http://www.geographx.co.nz/digitalmapdata.html#elevationdata (http://www.geographx.co.nz/digitalmapdata.html#elevationdata))  The 500m, 250m, and 100m data is free, but it looks as though the 20m data is available for purchase only.  I do not know if the data is freely available from the NZ government or not.

In regards to whether TG2 can load Geotiff formated height data the answer is yes.  As long as it is is exported as an Elevation type .tiff (32 bit floating point samples) it will load into TG2 no problem.

Personally, I use GlobalMapper to do all my conversions as it reads pretty much every type of .dem related format you can throw at it and outputs a file that works great in TG2.

My workflow is as follows:

1. Download data from whatever source
2. Open data in GlobalMapper
3. Convert to whatever projection I think will work best - for me either UTM or Geographic Lat/Long
4. Export to Elevation Geotiff (32bit)
5. Load Geotiff in to TG2
6. Set Lat/Long at apex (in the planet node) to be somewhere near the co-ordinates of your geotiff file.
Title: Re: GeoTIFF Dataset Workflow
Post by: Oshyan on December 27, 2010, 05:43:31 PM
One problem I've run into recently with this stuff is getting 16 bit (rather than 32 bit) GeoTIFFs from e.g. the USGS. This will give you issues upon loading into TG2. You just need to convert to 32 bit to make it work properly. This should be done in a GIS app of some kind, or some other terrain editor that will preserve the georeferencing data that may be embedded. Photoshop can do the conversion to 32 bit, but I'm not sure if it preserves metadata.

- Oshyan
Title: Re: Elevation Dataset Workflow - TG2 Supported Format
Post by: Tandem on December 28, 2010, 01:02:42 AM
Thank you all for your suggestions.  This is much more difficult then I thought it would be.

As Richard suggested, I downloaded ASCII and TIF versions of SRTM_SE_250m files from the CGIAR-CSI site (http://srtm.csi.cgiar.org/). Trying to load either version into TR2 I get the error "ReadImage: Unable to load image". Seems like not such a good idea to load such a large files into TG2, The uncompressed TIF is 5.5GB and the uncompressed ASCII file is 15.5GB. I would think the maps would need to be cropped first.

Richard,
Are you referring to Terragen or Terragen 2? Which of the files did you use to produce the image attached to your post?    Did you cropped the elevation map before importing it, or somehow extract only the Ruapehu area from the world file?

I was able to download a section of 25m resolution DEM from LRIS Portal (http://lris.scinfo.org.nz/layer/127-nzdem-south-island-25-metre/).  The dataset includes GeoTIFF file accompanied by .aux, .tfw and .xml files.  Loading the TIFF file does not cause any errors, but I don't know how to adjust the settings in the heightfield load shader in order for it to load/place correctly.  It looks like it may need to be scaled or something as the bounding box in the 3d preview window is larger than the planet.  This is probably what Richard is referring to
Quote from: cyphyr on December 27, 2010, 09:45:11 AM... You will need to rescale and move the geotiff to 0,0,0 ....
but I don't know what that means or how to do that.  I could not find any info regarding the Heightfield load settings in the docs nor the Wiki.

I tried to load the ASCII elevation files from geographx (http://www.geographx.co.nz/downloads.html) with no success.  Just like Ryan suggested, they probably need to be converted to 32 bit GeoTIFFs.
Edit: The geographx DEM ASCII files open just fine in SimpleDEMViewer.

It sure sounds like the 32 bit GeoTIFFs exported via GlobalMapper is the only way to get elevation data into TG2. GlobalMapper looks really impressive with the supported file format list, but a bit pricey for my use.  I would prefer to find a more direct way for the import or less costly alternative.

Just for a second, let's forget about the NZ elevation data.  What DEM file formats other than GeoTIFF are supported by TG2?  Can someone point me to a sample of the above mentioned supported ASCII DEM elevation files , just so I can see how this Heightfield import suppose to work in TG2?

In case this makes any difference, I am doing all this testing with the DEMO version - TG2 v2.1 (build 2.1.18.1)  Is the latest release of TG2 much different in regards to this functionality?
Title: Re: GeoTIFF Dataset Workflow
Post by: cyphyr on December 28, 2010, 05:36:58 AM
There's no functional difference between the free and full versions of Terragen other than:
Quote from: PlanetsideThe free version may only be used for non-commercial purposes and is limited in the following ways:

Render Size Maximum: 800x600
Render Detail Maximum: 1.0
Antialiasing Maximum: 3
Number of Rendered Populations: 3

As with many things in Terragen it is very useful to know your final purpose and intent for your image. Will it be viewed from space, will it have populations, trees etc, will it need to integrate with other imagery, data sets. Rather than building an entire scene or indeed planet and then deciding on where to place your camera it is much easier to work the other way round. The reason I move and re-scale the imported geotiff to 0,0,0 is that I will want to add populations (trees, forests etc) to it and these only work effectively near the zero point of the planet. To re-size the geotiff I do the following:

0 IMPORTANT ~ know that it is impossible for any flat bit map image tp map "PERFECTLY" onto a sphere, THERE WILL BE DISTORTION, the issue then becomes one of how much distortion and where it is. This is not a limitation of Terragen of the Geotiff file format but rather a limitation of living in a 3D spatial universe!
1 Load the 32bit Geotiff via the load terrain node and don't forget to tick "flatten terrain first".
2 In the "red" Heightfield shader node, tick "position centre.
3 Add a "Heightfield resize" from the Heightfield Operators sub menu.
4 Type in the new size of your hieghtfield in the "Heightfield resize" node in METERS.

Therefore in order for this to work you will need to know the exact dimensions of your geotiff (IN METERS). Sometimes this is unavailable or hidden/obscured in the lat/long data and not easily recoverable, a simple solution is to make an assumption that 1 pixel on your map represents a set distance in the real world and type these figures into your Heightfield resize node. As long as your GeoTiff and any imagery are at the same proportion and are given the same size and locations everything should match up perfectly. I've tested the files downloaded from Geographx and they work fine.

Good luck

Richard
Title: Re: GeoTIFF Dataset Workflow
Post by: Tandem on January 02, 2011, 09:58:54 PM
Thank you for all the good advice Richard, much appreciated.
Best wishes in 2011.