Monday, February 8, 2016

Resolving the ImportError: No module named paraview.simple when running VeloView

VeloView is an open source viewer for displaying point cloud data from a Velodyne laser sensor, you know the one used in driverless Google cars. After downloading and compiling the VeloView source code on an Ubuntu computer, I encountered some error messages when running the VeloView application, as shown below.
"ImportError: No module named paraview.simple"

Even though the application's main window appears, none of the commands work. And the reference grid is not displayed in the 3D view.

I figured the problem has something to do with Python being unable to locate required modules, and I added all the locations of all the other VeloView compiled packages - Paraview, VeloView, VTK into the PYTHONPATH environment variable, as shown below.


  1. Open up the .profile file in the user's home directory in a text editor, e.g.

    $ cd
    $ vi .profile
  2. Add in the following line.

    export PYTHONPATH=$PYTHONPATH:/usr/local/lib/paraview-4.3/site-packages:/usr/local/lib/veloview-3.1/site-packages:/usr/local/lib/paraview-4.3/site-packages/vtk

    A part of the .profile file is shown in the screenshot below.


  3. Save and close the .profile file.


Now when the VeloView application is run, the ImportError message no longer appears.


  


Monday, February 1, 2016

Visual Studio Windows Phone project has no Run Device or Mobile Emulators options

After upgrading my computer to Microsoft Visual Studio 2015, I opened up my old Windows Phone 8 projects to work on them. I found the Run Device or Mobile Emulators function missing, previously available in VS2013 and all the Visual Studio 2015 showed was a Start button, as shown below.

My first thought was that the installation probably had some problems and I spent a lot of time with repairing, and reinstalling Visual Studio 2015. After some time, I did a mouse right click in the Solution Explorer on the project and found the Retarget to Windows Phone 8.1 option, as shown in the screenshot below.

Right after the option was selected, the Start button changed to the Run Device/Mobile Emulators button.


That was what was needed to reinstate the function back to Visual Studio and I found it by accident after unsuccessfully doing a Google search or reading the documentation.
Hopefully this post will help some people.

Monday, January 25, 2016

WebApp for batch conversion of SVG vector files to raster PNG/JPEG images

This is a simple HTML5 WebApp for converting one or more SVG format files into raster image files in PNG or JPEG formats. At the same time, the user can choose to resultant raster image dimensions, whether it will be scaled at 25%, 50%, 75% or at a custom scale. The HTML5 canvas element is used to perform the conversion locally using the user's Internet browser without having to upload the SVG file to the web server.

  1. To run this WebApp, go to https://dominoc925-pages.appspot.com/webapp/svgimg/


  2. Optional. Click Settings on the right pane and change the Background color, transparency, scale factor, or the image format.


  3. Simply drag and drop the SVG files into the dashed box. Or click the Choose Files button and select one or more SVG files.



    The SVG file(s) are converted to raster image format.
  4. To save the converted image(s) one by one, just right click on the image and choose Save image as. Alternatively, click Main | Generate zip file on the right pane to generate a zip file containing all the converted images.


Monday, January 18, 2016

Columbia, Missouri 911 incidents monitoring WebApp

This WebApp allows users to monitor the City of Columbia, Missouri's real time 911 fire and rescue dispatch incidents on a Google Maps backdrop.

The 911 incidents are shown as clickable icons with tool tips on Google Maps. Clicking on an icon will bring up more details about the incident. Users can utilise additional built-in Google Maps feature such as Street View to immerse themselves in the incident's environment.


The 911 incidents are also shown as a list in the right pane. The list can be sorted by incident category, date-time and address - either in ascending or descending order. Clicking the Maps hyperlink will automatically locate, zoom, and center the incident in the Map View.

The WebApp can be launched from this link https://dominoc925-pages.appspot.com/webapp/columbiamo911mon/

Monday, January 11, 2016

IOS UIButton's image aspect fit mode does not work

I encountered a problem with displaying image icons in UIButton elements in IOS. As shown in the screenshot below, the icon images are stretched out disregarding the aspect fit mode set in Xcode.

After troubleshooting the issue, I found that setting the UIButton's image content mode manually to scale by aspect fit will solve the problem.

In Xcode, I link all the buttons with icons to an outlet. Then I loop through the buttons and set the content mode property, as shown in the example code listing below.


@IBOutlet var filterButtons: [UIButton]?

//...etc...

override func viewDidLoad() {
     super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
        
//Workaround to keep the button icons scaled properly
   for button in filterButtons! {
       button.imageView?.contentMode = UIViewContentMode.ScaleAspectFit
    }
}

The image buttons are now correctly rendered as shown in the screenshot below.

Monday, January 4, 2016

Normalize a Lidar LAS file with Fusion ClipData

There are occasions when it is necessary to normalise a LiDAR las point cloud file, i.e. removing the terrain heights. This can be useful if you are interested in the heights of objects e.g. vegetation canopy above the ground and not the undulations of the terrain below. An example of a las file point cloud is shown below; the shape of the terrain is very much evident.


The ClipData utility from the open source Fusion software can be used to normalise a LiDAR point cloud. The following steps illustrate how to normalise a point cloud.

  1. In a Command Prompt, type in the following to convert a digital terrain model DTM from ESRI Ascii ArcGrid to Fusion's DTM format, using the ASCII2DTM.exe utility.

    C:\> ascii2dtm.exe output.dtm m m 0 0 0 0 input_dem.asc

    An example run is shown below.

  2. At the prompt, type in the following.

    C:\> clipdata.exe /height /dtm:dakota_dem.dtm dakota.las output.las 606034 4889354 607400 4890580

    Note:
    /height tells the utility to normalise the point cloud
    /dtm:dakota_dem.dtm specifies the input digital terrain in Fusion's DTM format.
    dakota.las is the input las file
    606034 is the minimum bounding x value
    4889354 is the minimum bounding y value
    607400 is the maximum bounding x value
    4890580 is the maximum bounding y value


    An example run is shown below:


    A screenshot showing the normalised point cloud. Notice the point cloud no longer undulates with the terrain. 

Monday, December 28, 2015

How to fix a Lidar LAS file with a "version minor out of range" error

Recently I encountered some difficulties in working with LiDAR las files using open source software that make use of the liblas library. When attempting to open up the las file, the software would error out with a message complaining about "version minor out of range", as shown in the screenshot below.

After some investigation, it turned out that the file format version (at 1.4)  of the las file is higher than was supported by the software. In order to solve the issue, the las file can be downgraded to a lower file format version e.g. 1.2.

To convert the las file to version 1.2, you can use the pdal utility from the open source software Point Data Abstraction Library (PDAL). After downloading and installing, you can type in the following at the Command Prompt.

C:\> pdal translate --writers.las.minor_version=2 input.las output.las



The resultant file can now be opened, e.g. using the lasinfo utility as shown below.

Related Posts with Thumbnails