KML Cruncher - Mashup entry

The KML Cruncher was an entry in the Mashup Australia contest.

Click here to try the KML Cruncher

A utility that converts and generalizes ESRI polygon shape files into KML ready for the web. The KML Cruncher might is useful for people who want to quickly move from the shape file format into KML for web mashups.

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:

Step 1 Obtain the shape file you would like to convert and save it to a local drive.

There are many example shape files at http://data.australia.gov.au.

In this example I will use the ‘Drainage Basins Queensland’ dataset available at http://data.australia.gov.au/134. Note, this utility works with polygon shape files only, so ensure 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.

Step 2 Now you are ready to convert your shape file.

  1. Click on the Browse button next to the ‘Choose a shape file (*.shp):’ text box.
  2. Locate and select the *.shp file from your local hard drive.

In this example I used the ‘Drainage Basins Queensland’ dataset at http://data.australia.gov.au/134, therefore I will select ‘IQATLAS.QLD_DRNBASIN_100K.shp’ file.

Step 3 Specify the dbf file.

  1. Next to the ‘Choose a dbf file (*.dbf):’ field, click on the Browse button.
  2. Locate and select the associated *.dbf file.

In this example I specified the *.dbf file that is associated with the *.shp file select in step 2, therefore I will select the ‘IQATLAS.QLD_DRNBASIN_100K.dbf’ file.

Step 4 Specify a label field. Note this field is optional.

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 would like to inspect the data further before converting, try ESRI’s ArcExplorer product.

In this example I will set the label field to: BASIN_NAME

Step 5 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 is likely that you will have to convert the shape file a few times to get the right tolerance, luckily I have had a bit of time to play with it, so I will specify 0.005 as the tolerance.

Step 6 Convert

  1. Click the convert button.
  2. Wait patiently and you will have a nicely generalised KML file ready to serve on the web!

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.

Tags: , , , ,

Leave a Reply