6

Is there a way to bring data from a PostGIS database into Google Earth to view live?

I know of the asKml function in PostGIS, but I'm interested to know if it's possible to dynamically load KML-formatted data from PostGIS into Google Earth.

0

4 Answers 4

10

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

KML KMZ Output

1
  • +1 What I like with geoserver is that you can do all the styling within the application and then all desired output will inherit the same styling be it kml/kmz, map tile (slippymap) or a WMS.
    – maning
    Aug 6, 2010 at 8:19
5

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.

0
2

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.

0

You can try FME Desktop or FME Server from Safe Software. If you are using FME Desktop you can schedule the translation from PostGIS to KML. The KML can be pushed to a FTP or a dropbox account directly by FME, so that everytime you have new data in PostGIS, the KML also gets re-written.Read more about dropbox and FME at evangelism.safe.com/fmeevangelist52/

For some idea on FME Server and realtime KML look at this link: http://www.fmepedia.com/index.php/Real-time_Taxi_Cabs_(KML_Network_Link_Example)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.