Monday, July 28, 2014

NSISDotNetChecker plugin for installing the .NET framework if not found

The free Microsoft Visual Studio Express versions do not come with built-in Setup and Deployment wizards so if an installer is required then alternative commercial or free tools must be used. One such free tool I found is the Nullsoft Scriptable Install System (NSIS) which can be downloaded from http://nsis.sourceforge.net/Main_Page.

Using NSIS is a little more inconvenient than using Microsoft Visual Studio's Setup and Deployment project - for one thing files and dependencies must be typed into a script file, and the .NET framework dependency must be handled manually.

I found a NSIS plug-in for checking and installing the .NET framework from this web site https://github.com/ProjectHuman/NsisDotNetChecker. Just follow the instructions on the website to install it on your machine and use it in the NSIS script. However, the script DotNetChecker.nsh that you have to include in your script has a problem and must be edited. If the DotNetChecker.nsh script is used as is, then your installer will never be able to detect and install the .NET framework.

The following change must be made to the DotNetChecker.nsh include script.

  1. Open up the file DotNetChecker.nsh in a text editor.


  2. Locate the following line:

    ${If} $0 == "false"
  3. Replace false with f as shown below:

    ${If} $0 == "f"
  4. Save and close the file.
Now the installer built with this modified DotNetChecker.nsh script will be able to detect and install the .NET framework if necessary.

Monday, July 21, 2014

Useful tool (Dependency Walker) to troubleshoot a DLL's missing dependencies

When using external or third party dynamic link libraries (DLL) such as liblas in your development, sometimes those libraries depend on other files or assemblies and when they cannot be found in the current location or in the system path, your program may throw up some run time errors. I found a nice time saving tool called the Dependency Walker (http://www.dependencywalker.com/) which can help troubleshoot the missing files of a DLL.

Using the tool is easy - just download and extract into a folder, then run the depends.exe file. The depends application window will pop up.

The following steps show an example of using this tool to identify the dependencies of my liblas1.dll.

  1. Drag and drop the file for analysis into the Dependency Walker application window.

    An error message may pop up.

  2. Press OK.
  3. Review the Module pane for the missing files. If possible, locate and copy the missing files to the location of the DLL.


  4. Select File | Close.
  5. Repeat step 1 to 3 until the errors no longer appear. 

Monday, July 14, 2014

Resolving the error "The name xxx does not exist in the namespace "clr-namespace:XXX" in Visual Studio 2012 for Windows Phone

In Windows Phone 8 development, it is possible to use the local project's public classes in a XAML file. But the local project's namespace has to be included in the XAML file by typing in the following:
xmlns:local="clr-namespace:Binding".
Here Binding refers to the namespace used by the class in the local project I want to use.

Then to use the local namespace in the XAML file to declare a class, I should do the following:
<local:MyData x:Key="MyData"
AppTitle="Real Estate Explorer" />

Everything looks fine, but the Visual Studio Intellisense underlines the local:MyData reference with the following error message:
The name "MyData" does not exist in the namespace "clr-namespace:Binding"

An example is shown below:

I could not figure out how to resolve the error; I did everything as described in the documentation. Eventually, I did a Build Solution (F7) on the project. After that, Visual Studio did not complain about the namespace anymore, as shown in the screenshot below.
 

Monday, July 7, 2014

Merge SpatiaLite polygon geometries with the GUnion operator in QGIS

I wanted to merge two polygon geometries in a SpatiaLite database (an example is the land feature layer shown in the screenshot below) into a single geometry using QGIS.
Two SpatiaLite polygons labelled with the primary key id number.
In QGIS, the usual command to perform this task is the Union command, but unfortunately it creates only Shapefiles. The alternative is to use the QSpatiaLite plug-in and run some SQL commands to do the job. The following steps show how to merge two polygons into one polygon using the SpatiaLite GUnion operator.

  1. In QGIS, select Database | SpatiaLite | QSpatiaLite.

    The QSpatiaLite dialog box appears.
  2. Note down the primary key numbers or any suitable identifier of the polygons to be merged, e.g. pkuid 10 and 20.
  3. In the SQL tab field, type in the SQL command.

    SELECT GUNION
    (
    (SELECT geometry FROM land WHERE pkuid = 10)
    ,
    (SELECT geometry FROM land WHERE pkuid = 20)
    )
    AS geometry


  4. Click Run SQL.

    A temporary new geometry object is created.


    Note: if the above SQL command execution is successful, then it is fine to proceed to create a new merged polygon feature and delete the original two polygons.
  5. In the SQL tab, type in the following SQL command to create and insert a merged polygon feature record.

    INSERT INTO land (geometry)
    SELECT GUNION
    (
    (SELECT geometry FROM land WHERE pkuid = 10)
    ,
    (SELECT geometry FROM land WHERE pkuid = 20)
    )
    AS geometry

  6.  Click Run SQL.

    A new row is inserted into the land table.
  7. In the SQL tab, type in the SQL command to delete the original two polygon features.

    DELETE FROM land WHERE pkuid = 10 OR pkuid = 20

  8. Click Run SQL.

    The original polygon features are deleted.
  9. Refresh the map view by toggling the land feature display off and on.

    The merged polygon is displayed.

Monday, June 30, 2014

Trainsity Fortaleza Metro Android App

Find your way around the city of Fortaleza, Brazil using the high resolution vector maps of the MetroFor's West and South Lines. The maps have small file sizes and they can be zoomed in many times without becoming blur or blocky, and they can be displayed without an Internet connection. Users can tap the train station labels to open Google Maps or Street View, where they can use all the functions of the Google apps to visualize the surrounding area and/or perform routing for directions.

On a mobile handset, the app will display a list of train lines, which when tapped will open up a detail view of the metro transit map, as shown below.

Tapping the station boxes will bring up an option menu where users can choose to display the station in Google Maps or Street View.


The app is also optimized for tablet devices. The layout on a tablet will show both the list and the vector map at the same time, as shown below.


Users can toggle the map to full screen by tapping the action bar icon at the top right.

The app is available on the Google Play Store. Just click the button below.

Get it on Google Play

Monday, June 23, 2014

Change the dynamic rubber band display of features being digitized in QGIS

While digitizing new polygon features in QGIS, I found that the dynamic display of the new polygon to obscure other map layers that could aid in the digitizing work. As an example, see the screenshot below: the polygon being digitized is displayed in (almost) opaque red color fill that the features below is almost obscured.

There is a setting in QGIS that controls the color and opacity of the dynamic digitizing display.

To change the dynamic display properties do the following.

  1. Select Settings | Options in the application's menu.

    The Options | Digitizing dialog box appears.

  2. In the Rubber band field, click on the highlighted area (shown in red circle below).

    Note: There is a problem in QGIS 2.2.0 with showing the rubberband color - none is displayed, as shown in the highlighted area of the screen shot above.

    The Select Color dialog box appears.

  3. Optional. Choose another color, e.g. purple.
  4. In the Alpha channel field, type in another value e.g. 80. Click OK.

    Note: type in 255 for a fully opaque rubber band and 0 for a fully transparent rubber band.
  5. Click OK to close the Options | Digitizing dialog box.
  6. To see the effect, start to digitize another polygon.

Monday, June 16, 2014

Trainsity Rio de Janeiro Metro Android App


This is another Android App inspired by the on-going FIFA World Cup 2014 in Brazil. Using this, find the way around the city of Rio de Janeiro using the high resolution vector maps of the MetroRio's Orange Line 1Green Line 2 and the Subway Bus lines. The maps have small file sizes but high resolution which will not become "blocky" pixels when zoomed in. They can be viewed offline without an Internet connection. Users can tap the train station labels to open Google Maps or Street View, where they can use all the functions of the Google apps to visualize the surrounding area and/or perform routing for directions.

On a mobile handset, the app will display a list of train lines, which when tapped will open up a detail view of the metro transit map, as shown below. 
Tapping the station boxes will bring up an option menu where users can choose to display the station in Google Maps or Street View.
The app is also optimized for tablet devices. The layout on a table will display both the list and the vector map at the same time, as shown below.
Users can toggle the map to full screen mode by tapping the action bar icon at the top right corner.
The app is available on the Google Play Store. Just click the button below.

Android app on Google Play
Related Posts with Thumbnails