Monday, August 29, 2011

Listing the exported function names in a C/C++ dll

I found myself working with some low level C/C++ API for some software to hardware interfaces. This can involve quite a bit of work figuring out function names, pointers, addresses and memory handling. Sometimes the function names in the documentation do not correlate with the DLL. To help list the exported functions in the DLL, I found the dumpbin utility from the Microsoft Visual Studio IDE to be quite useful in helping me to write C# wrappers for the C/C++ dynamic link libraries.

An example usage is shown below.

  1. Simply open up the Microsoft Visual Studio Command Prompt Window.
  2. Then type the following in the Command Window, where shapelib.dll should be replaced with the name of your DLL you want to read:

    C:\> dumpbin /exports shapelib.dll


Monday, August 22, 2011

Export ground points from a LAS file to ASCII CSV file using FME

This is one of the typical LiDAR file conversion task - converting a LAS (*.las) file to an ASCII XYZ or CSV (*.csv) file. It can be done with any number of free and commercial software. It is a simple matter to define a workspace using the FME Workbench from SAFE to do the job. Here are the steps that I used to export out only ground points from a LAS file into an output ASCII CSV file.

  1. Start the FME Workbench. Create a blank workspace.
  2. Select Readers | Add Reader. In the Format field, choose ASPRS Lidar Data Exchance Format (LAS). Choose a dataset e.g. C:\data\lub_tile1.las. Click OK.

  3. Select Writers | Add Writer. In the Format field, choose Comma Separated Value (CSV). Choose an output dataset e.g. C:\Temp\.

  4. Click Parameters. If necessary, change the extension from the default csv. Choose another Separator Character if comma is not wanted. Click OK.

  5. Click OK again.

    The prompt appears.
  6. Click Yes.

    The Feature Type Properties dialog box appears.
  7. In the Feature Type Name field, type in the output CSV file name e.g. outascii.
  8. Click the User Attributes tab. Define number attributes for the X,Y,Z values as shown below. Click OK.

  9. From the Transformer Gallery, drag and drop the PointCloudCoercer, CoordinateExtractor, and Tester transformers onto the workspace.
  10. Connect up the source, transformers and destination as shown below.

  11. Open the PointCloudCoercer Parameters. Change the Output Geometry to Point. Click the Point Components to Preserve button and select all. Click OK.

  12. Open the Tester Parameters. Define a Test Clause as shown below to allow only ground points (class=2). Click OK.

  13. Run the translation.

    The output ASCII CSV file is created.

Monday, August 15, 2011

Finding the Intergraph Host ID string for license generation

In order to generate licenses for Intergraph GeoMedia products, a host id may be required as input to the license  generation process. Whenever GeoMedia could not obtain a valid license, it will pop up the screen shown below.



Previously, the Host ID field contains only a 12 characters hexadecimal string e.g. 08002711d817, which is the actual host id string that can be copied and use to generate the software license. But recently, Intergraph changed the string to include additional hexadecimal characters but still labelled the entire string as the Host ID, which is confusing to users.

To get around this confusion, simply copy the first 12 characters from the entire string to use as the Host ID string, when you are prompted for it during the license generation process, as shown in the screen shots below.

Monday, August 8, 2011

Display information about a LAS file in SAGA GIS

The new SAGA GIS version 2.0.7 comes with a new function to show information about a LiDAR LAS file. Functionally, it appears to be similar to the command line lasinfo.exe executable from the open source libLAS library. The command can be accessed from the main SAGA GIS application window as shown below.

  1. Start SAGA GIS.

  2. Select Modules | File | Shapes | Import | LAS Info.

    The LAS Info dialog box appears.
  3. Click the LAS File row. Then click the browse [...] button.

    The Open dialog box appears.
  4. Browse and select a LAS file, e.g. lub_tile1.las. Click Open.

  5. Optional. Toggle on Only Header Info if you do not want to scan and summarize the entire LAS file.
  6. Click Okay.

    The Messages pane shows the information about the selected LAS file.

Monday, August 1, 2011

Find intersections between polygons using Global Mapper

Even though Global Mapper is not a spatial analysis software, it has some limited spatial functions such as the Find Intersection of Selected Areas command. It is available in a pop up menu somewhere within the software. Here is an example of using the command.

  1. Start Global Mapper 12. Load or create a polygon layer with intersecting polygons.

  2. Press ALT+D.

    The Digitizer toolbar appears.
  3. In the Map view, select two or more intersecting polygons.

    The polygons are selected.

  4. Press the Mouse right button anywhere in the Map view.

    A pop up menu appears.

  5. Choose Find Intersection of Selected Area Features.

    A message appears.

  6. Click No.

    The Modify Feature Info dialog box appears.

  7. Choose a Feature Type, e.g. Wetland. In the Feature Layer drop down list, choose Create New Layer for Feature. Click OK.

    The Enter Layer Name dialog box appears.

  8. Type in a name, e.g. intersect. Click OK.

    The intersections are created.