Wednesday, November 11, 2009

Space-Time Research releases "The KML Cruncher"

Today Space-time Research submitted the KML Cruncher as an entry to the Mashup Australia contest under the “Additional Transformation Challenge – Opening Up Government Data Sets” section. It’s a utility that converts and generalises ESRI polygon shape files into KML ready for the web, useful for those people who quickly want to move from the shape file format into KML for web mash ups without the fuss of obtaining heavy weight GIS systems.

Using the utility is easy - here’s an example of how to convert an ESRI polygon shape file to a KML file ready for the web:

1) Firstly obtain the shape file you would like to convert and save it to a local drive – there are many example shape files at , for this example we will be using the ‘Drainage Basins Queensland’ dataset available at Note, this utility works with polygon shape files only, so make sure you obtain a shape file that contains polygons (also referred to as ‘boundaries’). The ‘Drainage Basins Queensland’ dataset is archived in a .zip file, so make sure you extract it to your local drive before continuing.

2) Now you’re ready to convert your shape file, click on the ‘Browse’ button next to the ‘Choose a shape file (*.shp):’ text box and choose the *.shp file from your local hard drive. In this example we will be using the ‘Drainage Basins Queensland’ dataset at, so we will choose ‘IQATLAS.QLD_DRNBASIN_100K.shp’.

3) Click on the ‘Browse’ button next to the ‘Choose a dbf file (*.dbf):’ text box and choose the associated *.dbf file. We must specify the *.dbf file that is associated with the *.shp file we chose in step 2), so we will choose ‘IQATLAS.QLD_DRNBASIN_100K.dbf’ file.

4) Next we’d like to specify a label field. The label field is used as an identifier for each of your converted polygons – once in KML format this is what will be shown in the information window when you click on a polygon. This field is optional, if you do not specify it, the utility will take the first field it finds. If you would like to know what fields are available in your .dbf file you can open it using Microsoft Excel, or if you’d like to inspect the data further before converting, try ESRI’s ArcExplorer product. For this example I’ll be setting the label field to: BASIN_NAME

5) Next we will specify a generalisation tolerance. In a nutshell the generalisation tolerance is a measurement between polygon vertices, if this tolerance is exceeded, one of the vertices will be removed. Generally you will need to specify a larger tolerance for more detailed data sets. It’s likely that you will have to convert the shape file a few times to get the right tolerance, luckily I’ve had a bit of time to play with it, so I will specify 0.005 as the tolerance.

6) Hit the convert button, wait patiently and you will have a nicely generalised KML file ready to serve on the web!

Here's a screen shot of the ‘Drainage Basins Queensland’ dataset transformed at a tolerance of 0.005, shown in Google Earth.

Also for the developers – this is a simple HTTP post action from a WEB form (nothing fancy) therefore it could easily be used as a web service…


No comments:

Post a Comment