Jump to content

How to edit DEM before importing into MeshTool


Colin S

Recommended Posts

Working on Hawaii Photoreal I've run into a bunch of walls: first it was how to georeference orthophotos (I did Lanai entirely by hand, dragging the nodes in WED until they lined up. I will never do that again). Then came making HD Mesh for Niihau. Niihau had no airports, and now I'm working on Molokai, which has several airports (four, to be exact), all of which are on tilted terrain, even in the 10m DEM. That sucks for keeping a plane on the centreline, and I thought, what if I could actually edit the mesh to make things at the airport be absolutely perfect. Turns out I can. The first idea I had was to try Mesh Remexe (or whatever it's called) which is glitchier than a Comet 1. After searching for month, I have found the perfect candidate for the ultimate set of tools for editing mesh in a user friendly environment (no command lines other than MeshTool, all GUI). Here's what you'll need:

  1. QGIS - get the latest. Possibly the best free GIS program in the world. Familiarize yourself with how to create, edit, and delete shapefiles.
  2. SAGA GIS - Not as broad as QGIS but it has some pretty snazzy features that QGIS lacks, notably a visual attribute editor. You'll understand what that means in a few minutes.

Before we begin, I want to make something clear: I am sick of people telling me I'm an idiot for not knowing how to use command line tools. I'm not a programmer. I'm a scenery developer. I have no interest in living in the 1980s. We live in the age of GUI. So if you are just going to post a reply about how some command line tool can do this so much faster, get out. Simple as that. I'm not interested. This is for those who want a simple and pretty solution ot a very complex problem.

Here are the next things you'll need:

  1. DEM - The elevation data for the area you're working on in DEM format. The USGS provides 10m shuttle acquired DEM. Welcome to the future.
  2. Water Shapefiles - Unfortunately, MeshTool is a little old and has no ability to figure out where water belongs so you'll have to do some reading yourself on how to layout a script file.

The first step in this is that the Shuttle DEM isn't perfect. The elevation data (nearly) is, but the limits of its range aren't. MeshTool, again showing its age and incompatibility, refuses to acknowledge anything that doesn't conform to X-Plane's perfect 1x1 degree tile grid. If it's even 0.0000001 degree over, MeshTool will crash. You will need to use QGIS to crop the DEM down to nothing more than 1x1 degree. YouTube and Google have lots about cutting up DEM in QGIS or other programs. This I will leave up to you and assume we can now work with our awesome, perfect DEM. 

The next step is getting coastlines aligned. This will take ten minutes max (unless you're me and are aligning orthophotos to coastlines to the pixel, in which case it will take upwards of ten hours). I'll assume you're 'Murican, so head over to the USA Census TIGER data sources. There are sources like this for Canada as well. No idea about anywhere else (yet). Find the water area for the state/county you are working in, and make sure that if it has ocean that you add in the rest of the ocean beyond territorial waters. This is all preliminary though, so that MeshTool spits out a DSF that doesn't have a dried up ocean. This is where the new stuff comes into play:

EDITING DEM ELEVATION DATA

This is where SAGA GIS arrives on our doorstep. Download it (safe, no viruses, even though it's from SourceForge). Open it up and look over it. Acquaint yourself with the layout, it's quite different from QGIS. In the bottom of the far left pane you'll see a filetree. This will allow you to find your DEM file that you've cut up. Double click it. It will load and show up in your project tree, but not on the big empty map. Now you right click it and say "add to map." Presto, you have a wonderful rainbow coloured map of Hawaii (or wherever you're working). Head on back to QGIS. We need one last shapefile. 

Create a new shapefile called whatever you want, and outline the area at your airport that you want to adjust the elevation of. We have to do this because in SAGA GIS you won't be able to see where the airport is so you won't know what pixels you'll need to edit. 

In SAGA, open and load into your project this new *.shp file the same way you got your DEM in. Now you can see the area of your airport or shoreline or whatever you're editing. Now comes the black magic, what almost no other GIS software does easily without command line sorcery. Switch to the pointer-selection tool, and zoom in on down to your airport. Click on a pixel. Nothing will happen other than that it will be highlighted. In the pane to the right of your project tree, you should see different tabs selectable. One of them is Attributes. Open it and you will see one measly little number. You can edit this number or you can highlight a wackload of numbers to achieve much more in much less time. The downside is that you cannot batch-edit these pixels, and the selection must be quadrangular. 

This is very important: Make sure the your airport outline shapefile is WITHIN the flattened area. This is how MeshTool creates the polygons based on elevation change amounts.

Click on a different item in your project tree, and it will ask something to the tune of "Do you want to save?" Don't worry, it's not going to close, it's just saving changes... within the project. Yes, obviously, save. Now you need to Export.

Under the menu go to GeoProcessing File Grid Export Export GeoTIFF. You will probably want to export it as something named differently from your original file. This has just created a new DEM as modified by you. Congratulations. You are now a Mesh Editor without knowing a bit of command line language. I'll leave MeshTool up to you. If you need help with that, the manual is actually surprisingly confusingly usefulish. The real thing you need to know for MeshTool is that the Script file is just the "what to do, in the order that you want it to happen." Like any script.

Cheers and happy Meshing! 

Don't mesh about too mucsh.

Edited by Colin S
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...