POV-Ray : Newsgroups : povray.newusers : converting DEM to height field Server Time
13 Nov 2024 17:48:05 EST (-0500)
  converting DEM to height field (Message 1 to 6 of 6)  
From: Eric Fielding
Subject: converting DEM to height field
Date: 14 Jul 2000 10:25:58
Message: <396F2301.20E5FDFF@sierras.jpl.nasa.gov>
Does anyone have a program or code fragment (C or Fortran) to convert a
"raw" Digital Elevation Model to one of the height_field formats that
POV can use? I have MacDEM, but it only reads the standard USGS DEM
format or ASCII text PGM files.

It seems a bit inefficient to store a DEM with 16 bits per sample in a
24-bit per pixel TARGA or PNG or PPM image, but I guess those formats
contain the image size in a convenient form.

					++Eric


Post a reply to this message

From: Christoph Hormann
Subject: Re: converting DEM to height field
Date: 14 Jul 2000 11:02:24
Message: <396F2B81.372AFA6A@schunter.etc.tu-bs.de>
Eric Fielding wrote:
> 
> Does anyone have a program or code fragment (C or Fortran) to convert a
> "raw" Digital Elevation Model to one of the height_field formats that
> POV can use? I have MacDEM, but it only reads the standard USGS DEM
> format or ASCII text PGM files.
> 

You should have a look at the POV-sourcecode.  There you can find code for
writing/reading tga-files and samples how to use pnglib for png-files.  

> It seems a bit inefficient to store a DEM with 16 bits per sample in a
> 24-bit per pixel TARGA or PNG or PPM image, but I guess those formats
> contain the image size in a convenient form.
> 

I usually use 16Bit png files for that purpose.

Christoph

--
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Vahur Krouverk
Subject: Re: converting DEM to height field
Date: 14 Jul 2000 11:35:00
Message: <396F3333.7FBCE45@aetec.ee>
Eric Fielding wrote:
> 
> Does anyone have a program or code fragment (C or Fortran) to convert a
> "raw" Digital Elevation Model to one of the height_field formats that
> POV can use? I have MacDEM, but it only reads the standard USGS DEM
> format or ASCII text PGM files.
> 
> It seems a bit inefficient to store a DEM with 16 bits per sample in a
> 24-bit per pixel TARGA or PNG or PPM image, but I guess those formats
> contain the image size in a convenient form.
> 
>                                         ++Eric

I've made simple conversion program DEM->16-bit TGA. It's source code
could be found in this news server:
From: Vahur Krouverk <vah### [at] fvaeteceenospam>
Newsgroups: povray.binaries.utilities
Subject: Re: Problem DEM2POV/DEM2TGA?
Date: Sat, 09 May 1998 19:42:00 +0300

news://news.povray.org/35548758.265F2F5B%40fv.aetec.ee.nospam

Feel free to use it as You like.
Note, that it has defect: it opens input file in text mode, which causes
output data corruption in Windows systems. If You are in *IX world, then
it shouldn't be problem, but on windows there should be instead of:
   if ((inf = fopen(filename, "r")) == NULL) {
     fprintf(stderr,"Error opening input file %s\n",filename);
     exit(1);
   } 
                                |----- add this!
this code:                      v
   if ((inf = fopen(filename, "rb")) == NULL) {
     fprintf(stderr,"Error opening input file %s\n",filename);
     exit(1);
   }


Post a reply to this message

From: Josh English
Subject: Re: converting DEM to height field
Date: 17 Jul 2000 13:32:39
Message: <3973439D.36885785@spiritone.com>
Is this on a Macintosh? Becasue I use MacDem with success and ease. I do
need to use a few other programs as well, tho. Here's what I do.

1. Go to http://edc.usgs.gov/doc/edchome/ndcdb/ndcdb.html
2. Click on 1:24,000 DEM.
3. Click on ftp via... ( I use ftp by graphics personally)
4. Eventually you will have an ftp link to a specific file that is named
10.2.1.1005691.tar.gz or something. Save this file to a new folder
somewhere.
5. Open the file with MacGzip ( downloaded from the Info-Mac HyperArchive)
This converts the file to a .tar file.
6. Extract the .tar file with tar (also downloaded form the IMHA) this will
place a large group of files in the folders. Most of them have .ddf
extensions
7. Open MacDem ( dld form www.treeswallow.com/macdem)
8. Open any of the .ddf files with the "Import STDS DEM..."
9. After a bit of processing you will have a small window with the color
data.
10. Select "Export POV Targa" from the file menu. This saves a .tga file
and a .pov file that you can start working with.

Be careful, since sometimes the output targa file pov uses has the exact
same name as the targa file MacDem outputs, thus causing problems. Chekcing
the filenames first should work.

Okay, I'll grant that this isn't easy at first, and it took me a bit of
experimenting to figure out, but it's the fastest way I've found

Josh


Eric Fielding wrote:

> Does anyone have a program or code fragment (C or Fortran) to convert a
> "raw" Digital Elevation Model to one of the height_field formats that
> POV can use? I have MacDEM, but it only reads the standard USGS DEM
> format or ASCII text PGM files.
>
> It seems a bit inefficient to store a DEM with 16 bits per sample in a
> 24-bit per pixel TARGA or PNG or PPM image, but I guess those formats
> contain the image size in a convenient form.
>
>                                         ++Eric

--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Andrea Ryan
Subject: Re: converting DEM to height field
Date: 17 Jul 2000 14:10:45
Message: <397349A7.F851BD91@global2000.net>
Thanks for the link.  Are all of the dff files used to make the dem file?  I
use 3dem and untgz.
Brendan


Post a reply to this message

From: Eric Fielding
Subject: Re: converting DEM to height field
Date: 18 Jul 2000 01:15:45
Message: <3973E80C.2A4E740@sierras.jpl.nasa.gov>
Josh English wrote:
> 
> Is this on a Macintosh? Becasue I use MacDem with success and ease. I do
> need to use a few other programs as well, tho. Here's what I do.
>

Thanks for the info. I have MacDEM, but I want to use digital elevation
models from other sources than the USGS, including preliminary data from
the Shuttle Radar Topography Mission. The MacDEM program is great for
the standard USGS DEM's.

				++Eric


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.