[postgis-users] Write out KML for each database record?

guido.lemoine at jrc.it guido.lemoine at jrc.it
Thu Oct 25 00:19:33 PDT 2007

Writing individual files to disk and then serve them via http
is a bit awkward. You should be able to do this in one go, without
writing the files. We do exactly that using JSP/JSTL (so you can
actually skip most of the Java curve...). If you use networklinks
in Google Earth, you can neatly capture the BBOX from the GE
request in your JSP controller page and forward to your SQL
parser pages (which build up the (sorted) KML as well). If your data is
dynamic, you can set the refresh properties of your link so that
you have an actual view of your data sets.

Make for a wonderful light-weight map server. We have tested this
recently in an operational set-up. Gives whole new meaning to 
"collaborative feature capturing".

I reckon you can do this in PHP somehow as well, but I have lived
long enough to walk the Java path...


>-- Original Message --
>From: Dane Blakely Springmeyer <blake at hailmail.net>
>Subject: Re: [postgis-users] Write out KML for each database record?
>Date: Wed, 24 Oct 2007 17:46:12 -0700
>To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>Reply-To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>Thanks for the great suggestions. I'm two weeks old with PostGis at  
>this point, so yes, its very exciting to know how much is possible.
>When you emailed I was just learning about MIME-Types and had just  
>finished also making a auto-generated link to view those same kml's  
>in google maps like you tried. The page now reflects that idea  
>On Oct 24, 2007, at 4:52 PM, Jason Birch wrote:
>> Hi Dane,
>> That's pretty cool stuff.  You can even paste your KML right into  
>> Google Maps and display it in 2D fairly easily.  You can create  
>> links to this from your page with a simple:
>> http://maps.google.com/?q=http://dev.riverchange.org/kml/457.kml   
>> (for instance)
>> There are lots of cool things you could do with PostGIS on the back 

>> end, like set up a network link to a PHP script that does a bounds  
>> request and returns all of the features from within those bounds  
>> when the width/height are within a certain tolerance.  This works  
>> well-enough in Google Earth and also in Maps.  For better  
>> performance in Google Earth, you could create a "master" kml file,  
>> which has network links to each of the polygons with Regions  
>> associated with them so that they are only fetched when in close- 
>> proximity.  If you returned the bounding coordinates for each  
>> geometry in your query, you could actually be generating this at  
>> the same time as you are generating your individual files, building 

>> it up one-link for each iteration through the record set.
>> Couple things:
>> - doesn't look like names are showing up correctly yet...
>> - your server doesn't appear to be configured with the correct MIME-

>> type for KML files.  Without this in place, many browsers (OK, well 

>> at least IE) will just display the XML
>> Jason
>> ________________________________
>> From: Dane Blakely Springmeyer
>> Subject: Re: [postgis-users] Write out KML for each database record?
>> I've now written a SQL query that creates a relative http link within
>> respective database rows that points to those kml files.
>> <winmail.dat>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>postgis-users mailing list
>postgis-users at postgis.refractions.net

More information about the postgis-users mailing list