Friday, August 28, 2009

QC digital terrain model for isolated spikes with color gradients

A quick way to find out whether your digital terrain model file has isolated high points or spikes is to display the terrain model with a color gradient from blue to red as shown in the Global Mapper screenshot below.

In this example, the terrain surface is mostly shaded in blue tones. That is a good indication that there are some elevation spikes somewhere in your terrain model.

A screenshot of a digital terrain model file with no high points is shown below. A good terrain surface is shaded evenly with the colors nicely balanced from blue to red as you go from lower elevations to higher elevations.

This is one way to quickly check your digital elevation models for the presence of isolated elevation spikes.

Wednesday, August 26, 2009

Some useful Linux remote commands (to me)

Sometimes I need to dial in to a remote computer running Linux to run some Linux batch processing commands which may take a while to complete. Normally, once you logged out from the remote computer, the processes that you started during the remote login session will be terminated. There is a modifier command that you can use to make sure the processes keep on running even after you logged out.

The modifier command is nohup, which stands for "no hang up". This is how it is used:

$ nohup your_long_process_command &

where your_long_process_command is obviously your long process command name.

Any processing messages printed out by your process would be rerouted to the text file nohup.out.

You can now logged out from the remote computer.

The next time you dial in to check on the status of your process, you can either review the nohup.out file with a text editor or you can run the following command to see whether it is still running in the process list.

$ ps -ef | grep your_long_process_command

If it returns a process list number, then it is still running.


Wednesday, August 19, 2009

Quickly attach xls/csv/dbf files in GeoMedia

GeoMedia allows you to connect to text files via the Text File Data Server connection, which requires you to define a text file server definition file. Although this method is powerful and flexible, it is not easy for users to grasp. There is an alternative quick and easy way in GeoMedia to attach and display the same text files via the Attach as Feature Table function. This function also allows you to display Excel spreadsheets (*.xls) and Dbase files (*.dbf), in addition to CSV text files (*.txt, *.csv). Here are the steps.

In this example, I want to attach the CSV text file shown below in a text editor. It has the standard header in the first line and the comma separated records below that.

  1. In GeoMedia, connect to a Access read/write database.

  2. Select Warehouse > Feature Class Definition.

    The Feature Class Definition dialog box appears.


  3. In the Feature Classes box, click a Access read/write connection e.g. tmp. Click Attach.

    The Attach dialog box appears.


  4. In the Type combo box, choose the type of file you want to attach, e.g. Text. Click Browse.

    The Open dialog box appears.


  5. Browse and select the file you want to attach, e.g. gps.csv. Click Open.

    The Attach dialog box is updated with the selected file.


  6. If you like, change the default name of the target table. Click OK.

    The attach feature table is appended to the Access connection.


  7. Click Close.
From now on, you can display and manipulate the records in the attached file within GeoMedia. For instance, you can select Window > Data Window and display the contents of the file as shown below.

Tuesday, August 4, 2009

Create a GeoTiff image from shape file using FME

I thought I'd try out using FME to create GeoTiff images from vector geometries. It is actually quite straightforward and the trick is to make sure that the fme_color attribute is set to some rgb value either explicitly or through the PenColorSetter transformer. In this simple example, I convert a polygon geometry shape file to a GeoTiff image file.
  1. Using the FME Workbench, create a Shape file to GeoTiff translation workflow as shown in the figure below. Add in the PenColorSetter and ImageRasterizer transformers and connect them up accordingly.



  2. Open up the PenColorSetter Parameters. Define a Pen Color, e.g. red.



  3. Open up the ImageRasterizer Parameters.

  4. In the Rows/Columns or Cell Size field, choose RowsColumns (if you want to set the GeoTiff image file dimensions by cell size, then choose CellSize and define the X and Y Cell Spacing).

  5. In the Number of columns field, enter the horizontal pixel dimensions e.g. 1000.

  6. In the Number of rows field, enter the vertical pixel dimensions e.g. 800.

    The ImageRasterizer Parameters may look like this at this point.


  7. Close the ImageRasterizer Parameters dialog box.

  8. The source and destination coordinate system should be set if you want to create a geo-referenced GeoTiff image file. In the Navigator pane, define the source dataset coordinate system, e.g. LL84 for geographic WGS84.


  9. In the Navigation pane's destination coordinate system parameter, define the destination GeoTiff dataset's coordinate system, e.g. LL84.

  10. Run the translation.

    The GeoTiff image file is generated.
The resultant GeoTiff image file can be opened up in any GIS application software like GeoMedia or Global Mapper as shown below.