Monday, May 30, 2011

Convert between GDM2000 and Peninsular Malaysian States Cassini coordinates using this Google gadget

Note: This Google Gadget no longer works as Google no longer supports Gadgets on web sites. A WebApp version is available on this site http://dominoc925-pages.appspot.com/webapp/gdm2000cassini/default.html.

GDM2000 or Geodetic Datum of Malaysia 2000 and Cassini-Soldner are coordinate systems commonly used in the Peninsular Malaysia States of Johor, Negri Sembilan, Melaka, Pahang, Selangor, Terengganu, Penang/Seberang Perai, Kedah, Perlis, Perak and Kelantam. This Google Gadget will allow you to convert between one or more pairs of State Cassini easting, northing coordinates and geographical GDM2000 latitude, longitude (GRS80) coordinates, all on GRS80 ellipsoid. It is possible to enter your own Cassini-Soldner projection parameters.

To convert easting,northing to latitude,longitude
  1. Select the Main tab (if it is not active)
  2. Type in one or more easting and northing coordinates in the Easting, northing text box, e.g. 8813.252,-23740.096.
  3. Click the Convert to Latitude,Longitude button (black pointing downward triangle).
To convert latitude,longitude to easting,northing
  1. Select the Main tab (if it is not active)
  2. Type in one or more latitude and longitude coordinates in the Latitude,northing text box e.g. 1:49:39.95355,103:38:24.93554.
  3. Click the Convert to Easting,Northing button (black pointing upward triangle)

To change the State Parameters
  1. Select the Prefs tab.
  2. Select the Use Cassini Parameters drop down list and choose a Peninsular Malaysian state e.g. Johor.

    The selected State's Cassini-Soldner parameters will be used for the conversion .

    Note: if you want to enter your own parameters, choose User-defined and type in the origin parameters

To change the coordinates delimiter character
  1. Select the Prefs tab.
  2. Select the Delimiter character drop down list and choose a character e.g. comma.

    The selected character will be the delimiter for your new key in coordinates and destination coordinates .
To change the latitude,longitude coordinate format
  1. Select the Prefs tab.
  2. Select the Latitude, longitude format drop down list and choose a format e.g. D:M:S.

    The selected format will be the format for your new key in latitude,longitude coordinates or the destination latitude,longitude coordinates.

Monday, May 23, 2011

Validate polygons for self-intersections using gvSIG

gvSIG has a rich set of topology tools that can be used to validate vector layers. Illustrated here is a simple validation test that can be done to check a polygon layer for self-intersecting polygons, i.e. polygons that intersect with themselves. The steps can be summarized as (1) build a topology with rules, (2) validate the topology. Once the errors have been flagged, the geometries can be edited and revalidated again.

Build a topology
  1. Start up gvSIG OADE 2010. Load and display a polygon layer, e.g. aoi.shp in a Map View.

  2. Select Tools | Topology | Create Topology.

    The Create topology wizard appears.
  3. Click Next.

  4. In the Topology name field, type in an appropriate name, e.g. SelfIntersection.
  5. In the Cluster tolerance field, type in a value, e.g. 1.
  6. In the Maximum number of errors field, type in a value, e.g. 20.

    Note: this number is the maximum number of flag errors that can be generated. Errors exceeding the value will not be generated.
  7. Toggle on the polygon layer to include in topology, e.g. aoi.shp. Click Next.

    The Topology rules page appears.
  8. Click Add.

    The Topology rules dialog box appears.
  9. In the Topology rule drop down list, choose No polygon of A may contain a self-intersection. Click Ok.

  10. Click Finish.

    In the legend, the polygon layer is now grouped under the SelfIntersection topology.
Validating the Topology
  1. In the legend, select the topology SelfIntersection to make it the active layer.
  2. Select Tools | Topology | Validate topology.

    Processing messages appear and the validation results appear. A new error layer SelfIntersection_error is created and displayed in the SelfIntersection topology group and also in the map window.

    Note: the SelfIntersection topology group icon has a red cross as shown above indicating the validation failed.
  3. Mouse right click on the SelfIntersection_error layer in the legend.

    A pop up menu appears.
  4. Choose Attribute table.

    The table: Attribute table:SelfIntersection_error appears.
  5. Scroll through the list of errors. Selecting one error record will highlight the corresponding error in the map window.

Monday, May 16, 2011

Convert GPS week/seconds to local date time Google Gadget

Note: A WebApp version of this Google Gadget is available here http://dominoc925-pages.appspot.com/webapp/calc_gpstime/default.html.

The GPS date is normally expressed as a week number and a seconds-into-week number. This format is not quite as easy to work with as normal date time. For that reason, this calculator was written to help convert the GPS week-seconds format into a local date time form that can be easier to read. The gadget will incorporate the GPS leap seconds from 1980 to 2012 into the conversion.

For more information about GPS Time, go to http://www.oc.nps.edu/oc2902w/gps/timsys.html.

To use the calculator, simply do the following:
  1. Enter the GPS Week and GPS Seconds with a comma as the delimiter, 
  2. Select the desired local time zone, and 
  3. If necessary, select the desired local date time format in the Pref tab. 
  4. Click the Convert to local time button


Monday, May 9, 2011

Merge and dissolve polygons using gvSIG

Sometimes I need to combine polygons of two different feature types into a single polygon. The free and open source GIS application gvSIG provides the spatial tools to perform that task Essentially all I needed to do was to perform a spatial merge operation followed by a spatial dissolve operation. The following illustrates the procedure.
  1. Start up gvSIG OADE 2010. Open a Map View and load the polygon layers to combine, e.g. aoi.shp and buffer.shp.


  2. Select View | Geoprocessing Tools.

    The Geoprocessing tools dialog box appears.

  3. Expand the tree nodes and select Geoprocessing tools | Data conversion | Merge. Click Open tool.

    The Analysis tools dialog box appears.

  4. In the Input layer list, press CTRL and left mouse click on the layers to merge, e.g. aoi and buffer.
  5. In the Use layer attribute fields, choose the layer to use to define the fields for the output merged layer, e.g. aoi.


  6. Click OK.

    The merged layer is generated.

  7. If the Geoprocessing tools dialog box is closed, select View | Geoprocessing tools.


  8. Expand the tree node and select Geoprocessing | Analysis | Aggregation | Dissolve.

    The Analysis tools dialog box appears.

  9. In the Input layer field, choose the merged layer, e.g. merge.shp.
  10. In the Field to dissolve on, choose an appropriate field, e.g. Field1.

    Note: only polygons with the same field value can be dissolved. Prior to this step, you must ensure the attribute field values have the same values.
  11. Toggle on Dissolve adjacent features only.
  12. In the Output layer field, click Choose.

    The Save dialog box appears.
  13. Browse and type in the output File Name, e.g. dissolve.shp. Click Save.
  14. Click OK.

    The polygons are dissolved.

Monday, May 2, 2011

Setup a Map View in gvSIG for working in SVY21

gvSIG can be used to work with local projections such as Singapore's SVY21 Projection coordinate system. as the software comes pre-configured with the parameters for the SVY21 spatial reference. It is just a matter of searching and then selecting the correct projection from a list.

  1. Start gvSIG OADE 2010.

    The gvSIG Application window appears.

  2. In the Project manager window, click the New View button.

    The Untitled -0 view is added to the View list.

  3. Select the newly created view and click the Properties button.

    The View properties dialog box appears.

  4. Click the Current projection button.

    The Spatial Reference System (SRS) dialog box appears.

  5. Choose EPSG Type.
  6. Ensure the By Code is toggled on. In the Search criteria text box, type in 3414. Click Search.

    The SVY21 projection is displayed in the list box.
  7. Click OK. Click OK to close the View properties.

    The coordinate system of the view is now set to use the SVY21 Projection