Live KML from PostGIS to Google Earth

You can do it with GeoServer. Installing and "linking" Geoserver to Postgres/PostGIS database is quite easy.

KML KMZ Output


This can be done by creating a Network Link KML, with the <refreshInterval> and <viewRefreshMode> (reference) settings set appropriately. As listed in the example, you'll need a script which returns the new response, in this case by sending the query down to PostGIS to respond with an updated asKml result.


The asKML function only returns the geometry in KML format - not the entire response. You will still need to write some sort of web service to create valid KML to return to the client.

It is not hard to do but you will need to write out all the XML required in the KML document. The nice part of the asKML function is you don't have to write all that tedious geometry xml tags.

Once you write the service then you can point google-earth at the URL for the service.