Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to convert a DEM (Digitial Elevation Model) file (e.g. from SRTM) into a 3D model that I can then edit with regular 3D modeling tools (e.g. Meshlab/Blender/etc.). However I'm using Ubuntu Linux.

So, is there any open source programmes / tools that can do this? And if so, can you give me a simple guide for how to convert a DEM to a 3D model. (command line programmes perferred)

share|improve this question
add comment

7 Answers 7

Blender has a Python API. Therefore, I use Python in Blender and import the GDAL libraries and construct a Blender-native mesh directly from the GIS data. The only thing you need to be careful of is that the version of GDAL you have matches the version of Python in the Blender release you are using.

EDIT Plugins:
If you don't want to write your own script using the Blender Python API and GDAl, there are some plugins which are available as standard which may help:

  1. Import DXF
  2. There are importers for OBJ, X3D and VRML and some 3D GIS systems will export to these (e.g. ArcScene and NVIZ) though this route is maybe necessarily strictly free.

There is an add-on for XYZ data but it is non-standard and aimed mainly at molecular data, though perhaps you could bend it to your will. For a full range of off-the-shelf importers for Blender see here. There is a PDS .IMG importer in Blender but GDAL can only read PDS IMG files (not to be confused with Erdas IMG files which are different).

So, really, your best bet if you have a GeoTiff, ASC or just about any other height data raster is to write a little script to iterate over the raster as there is no ready-made plugin for most use-cases, unless you can export your DTM to DXF, VRML or OBJ.

share|improve this answer
    
Is there any particular plugin or anything that I can download and play with? –  Rory Feb 24 at 16:10
1  
Your best best is scripting your own - see my edits. –  MappaGnosis Feb 24 at 16:52
add comment

Never tried it, but here is NVIZ. All you need is QGIS, which you can download for Ubuntu Linux.

share|improve this answer
add comment

I have found that NVIZ (which is a part of the GRASS package) is a useful tool for visualizing DEM data as a 3D model.

In order to install the GRASS plugin (if you already have QGIS installed), just navigate to Plugins --> Manage and Install Plugins --> Get More and install GRASS. Make sure it is checked in your Manage and Install Plugins list!

  1. Once you have GRASS installed start by adding your raster layer. You can do so by navigating to Layer -> Add Raster Layer -> Select

  2. Then create a new mapset in GRASS. Do so by navigating to Plugins -> GRASS -> New Mapset or use the GRASS tool bar that should be visible. A. Select a location for your GRASS dataset B. Enter a new location name of your choice C. Select your desired projection D. Select a region from the drop down list or manually select one using lat/long coordinates (you can look up the lat/long of your location on the web) E. Enter a new mapset name and then click Finish.

  3. Next you'll want to load your DEM or raster layer into GRASS. You'll do this by A. Navigating to Plugins -> GRASS -> Open GRASS tools B. Under “Modules List”, select “r.in.gdal.qgis” C. Under “Loaded layer”, select your layer from the dropdown list, and name the output file D. Click “Run”

  4. Now you need to add GRASS raster layer to you mapset A. Navigate toPlugins -> GRASS -> Add GRASS raster layer or click on . B. Select your location and mapset, and then select your layer and Click “OK”

  5. You might want to color your raster. If so, A. Make sure you selected the correct output raster layer B. Navigate to Plugins -> GRASS -> Open GRASS tools C. Under the “Modules List”, click on “r.colors.table”. D. Select the input layer, and then choose a“Type of color table” E. Hit “Run”.

  6. NOW for the fun part. Visualizing in 3D using NVIZ. So you'll want to A. Set a specific map region for 3D modeling by navigating to Plugins -> GRASS -> Edit Current GRASS Region. Then either manually select the desired region by drawing a red frame with your mouse or set the coordinates in the dialogue box that appears. (This helps NVIZ determine what resolution to use) B. Navigate to Plugins -> GRASS -> Open GRASS tools C. Under “Modules List”, select “nviz” D. Select the raster for Elevation and Color (they can be the same one), and click on the square to the right (which means “Use region of this map”) E. Hit "Run"

Then play around with different views, heights and lighting until you have the desired image!

Hope this helps and please let me know if you have any questions!

share|improve this answer
    
I will note that I had trouble with the projection when using an SRTM layer. Does anyone have any suggestions? –  Zizah Feb 25 at 23:50
    
What kind of troubles? –  markusN Mar 21 at 22:32
add comment

nviz is not a standalone application, it is part of GRASS GIS, for 3D visualization and animation. If you want to export rasters, you need GRASS GIS (or GRASS in QGIS). You can export DEMs in various file formats, including Terragen Heightfield (.ter), VTK, PovRay, xyz, etc.

You can also use Paraview to open the VTK files and export them to other various formats

But Blender has also plugins for directly importing DEMS, as Blender Digital Elevation Importer or import shapefiles and rasters (ESRI Shapefile import/export and georeferenced raster importer), for example.

Kodex present also a solution for Visualising QGIS data with Blender with the SVG format

Look also Shaded Relief in Blender with SRTM data

share|improve this answer
add comment

You could simply add a dem file as *.tif in blender with the "import image as plane" addon. See this post where you can see how i made some high resolution 3d maps using a dem in blender: -> http://gis.stackexchange.com/a/80842/24809

After loading the dem into blender you can also edit it as you can edit an image.

share|improve this answer
add comment

Have you tried USGS & GTOPO30 DEM Importer ?

share|improve this answer
    
Some of the screenshots (and filenames) on that page make it look like a MS Windows programme. I need something that can work on Linux. –  Rory Feb 24 at 16:10
    
I'm not sure if it works on Linux or not. Perhaps you can check their documentation for this. –  Catlover Feb 24 at 16:20
add comment

IMO a combination of gdal2xyz.py and triangle and a reconfiguration of the output files of triangle (.node, .ele) in one of the supported text formats of blender or meshlab should work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.