Monday, October 27, 2014

Trainsity Manila Windows Phone App

With this Windows Phone 8+ app, find your way around the city of Manila using the high resolution vector maps of the MRT-3, LRT-1, LRT-2, and PNR Metro Commuter lines. The maps have small file size footprints but with many levels of zoom and can work offline without connecting to the Internet. You can zoom closer without having the details becoming blurred or "pixelated", like bitmap images. Users can click the train station labels to open Google Maps, where they can use all the functions of the Google app to visualize the surrounding area and/or perform routing for directions. There is also an offline function to calculate the best way to travel from a station to another station with a direction breakdown and estimated timings (which may vary from the actual travelling time).

The following screenshots show how the app looks like on a Windows Phone 8 handset.

When a tile is tapped, a detail map view of the selected line will appear, as shown below.

 Tapping a labeled box on the map will display the train station on the external Maps application, as shown below.

If you want to find how long it takes to travel from one station to another station, and the best route to take, simply swipe to the Route page. Then type in the From station and To station. As you enter the values, a drop down list will appear and a station can be selected from the list. Finally tap the Execute icon.

 Tapping the more details link will display the recommended route to take.

Click the button below to download the app from the Windows Phone store.

Monday, October 20, 2014

Using SpatiaLite GUI to create a point geometry table from an ordinary table

Sometimes I have an ordinary table with numerical latitude and longitude columns and I need to construct a point geometry table from the records in the normal table, e.g. stations_raw. An example of such a table is shown in the screenshot below.

In the SpatiaLite GUI, enter the following SQL command to create a new table named stations:
CREATE TABLE stations AS 
SELECT
PK_UID,
code,
name,
ST_GeomFromText(
'POINT('||lng||' '||lat||')'
4326
)
AS Geometry
FROM stations_raw

Note: 4326 in the example command is just the geographical coordinate system SRID of the data.

Execute the command.


The table stations is created.


The table is still a non-spatial table. In order to change it to a spatial table, the following steps need to be done.

  1. In the SpatiaLite GUI, press mouse right click on the geometry column.


  2. In the pop up menu, choose Recover geometry column,

    The Recover Geometry column dialog box appears.

  3. In the SRID field, type in the data's SRID e.g. 4326 for geographical latitude and longitude data.
  4. In the Dims field, choose the appropriate dimensions of the data, e.g. XY for 2-D.
  5. In the Geometry field, choose the appropriate geometry of the data, e.g. POINT for point data.
  6. Press OK.

    If the parameters are correct, the following message will appear.


    The GUI should show the table as a spatial table (with a globe).


Sunday, October 12, 2014

Example SpatiaLite query to find neighbors of a polygon

A common spatial query is to find all the neighbor polygons touching a subject polygon. The screenshot below shows a SpatiaLite database of selected country feature polygons.

If you want to find all the neighboring countries of the country Canada, the following SpatiaLite SQL query can be used.
select b.name
from country a, country b
where touches(a.geometry, b.geometry)
and a.name = 'Canada'


The result 'USA' is returned.
 

Monday, October 6, 2014

Trainsity Singapore MRT for Windows Phone 8


This is a Windows Phone 8+ app for displaying the Singapore MRT and LRT metro network maps. The maps are high resolution vector files instead of raster images; the file sizes are small and you can zoom closer without having the details becoming blurred or "pixelated", like bitmap images.  The maps also have some interactivity coded in - when the train station labels are touched (or clicked), an option menu will pop up. Users can then choose to send the station location to the external Maps app where they can visualize the surroundings and/or perform directions routing.


The following screenshots show how the app looks like on a Windows Phone 8 handset.
 
When a tile is tapped, the detail map view of the MRT line will appear, as shown below.

Tapping a labeled box on the map will display the MRT station on the external Maps application, as shown below.

 If you want to find how long it takes to travel from one station to another station, and the best route to take, simply swipe to the Route page. Then type in the From station and To station and tap the Execute icon.

Tapping the more details link will display the recommended route to take.

 The app can be downloaded from the Windows Phone store.