This page last changed on Aug 07, 2007 by cholmes.

Introduction

GeoServer can return KML in one of two forms. The first is as a number of Placemark elements. Each Placemark corresponds to a feature in the underlying dataset. This form only applies to vector datasets.

The second form is as an Overlay element. In this form the rendering is done by the GeoServer WMS and only the resulting image is sent to Google Earth. This is the only form available for raster datasets, but can be applied to vector datasets as well.

Both forms are available for vector datasets, which one is used is driven by the size of the dataset. The first (Placemark) form looks nicer but if the dataset is large then the amount of data can cause Google Earth to hang trying to process it all. Having GeoServer render as an Overlay puts less of a strain on Google Earth, but unfortunately does not look as good.

The following shows the same dataset rendered in Placemark form on the left and Overlay form on the right.

KML Scoring

Luckily the user usually does not have to worry about this. GeoServer is smart enough to figure out which form should be used on its own based on the amount of data that is being queried. A threshold value is used for which if the number of features returned is greater then a certain value then the Overlay form is used. Determining this threshold value is called KML Scoring.

By default, GeoServer will use Overlay form if more then 2154 features are being returned to Google Earth. However this value can be controlled by the user via the KMSCORE parameter. The KMSCORE parameter is specified as part of a KML request and is an integer value between 0 and 100. The default value for this parameter is 50. If you have a high powered computer you can likely set this higher and get back more vector data.

GeoServer uses the following formula to calculate the feature threshold value:

number of features = 10^(KMSCORE/15)

The following shows the values of the feature threshold for different values of the KMSORE parameter:

KMSCORE Number of Features
0 Always Raster
10 4
20 21
30 100
40 464
50 2154
60 10000
70 46415
80 215443
90 1000000
99 3981071
100 Always Vector

Specifying KMSCORE

Specifying KMSCORE in a request easy.. All one must do is append the parameter "kmscore=<value>" to a KML request. For example:

http://localhost:8080/geoserver/wms/kml_reflecet?layers=topp:states&kmscore=20

vector.png (image/png)
vector.png (image/png)
raster.png (image/png)
raster.png (image/png)
Document generated by Confluence on Jan 16, 2008 23:28