Hi Jeff- > I have no idea where to send this and after signing up for the another > list server, I thought I might try here. Let me first say that I have > been using the heck out of gdal, ogr2ogr, and postgis for a few days > now to generate kml files with relative ease, using commands like: > > ogr2ogr -f kml himom.kml PG:"host=localhost dbname=$1" -sql "select > st_transform(boundary,4326), blah, blah, blah from my table" > > While this is awsome, I need to export a timestamp/timespan into the > kml file as well so I can make use of the time slider in google earth. > I'm a relative newbie to xml/kml and had no idea if ogr2ogr/postgis can > do this. I'm pretty sure after some experimentation, that concatenating > multiple files: > > ogr2ogr -f kml himom.kml PG:"host=localhost dbname=$1" -sql "select > st_transform(boundary,4326), blah, blah, blah from my table where time > = this_time" > > ogr2ogr -update -append -f kml himom.kml PG:"host=localhost dbname=$1" > -sql "select > st_transform(boundary,4326), blah, blah, blah from my table where time > = next_time" > > seems to only produce a file with the last query. So my questions are > these: > > 1) is it possible to include additional tags > <TimeSpan><when>...</when></TimeSpan> as part of the sql query (e.g. > next_time as TimeStamp), At this point the KML driver does not recognize the Date/Time type in OGR. Your idea is a good one, but since the output of the transformation is KML the driver should be escaping the content of the elements. So your content would end up like: <TimeSpanA> and so forth. See point 4 below for a possible solution.
> 2) Does anyone know if the -update -append works with -sql, It's not that it doesn't work with -sql, it's that the current KML driver doesn't support an update. > 3) While I think I can hack a solution (read I must hack a solution), > where is the documentation for adding features to ogr2ogr), http://www.gdal.org/ogr/ogr_drivertut.html is a good place to start. The existing driver is limited in its capabilities. I'm in the process of updating the driver to work with libkml, at which point updates and appends would be supported. > 4) Would it be easier to post process the generated kml file(s) and > manipulate the file/entries myself using another tool since I'm kind > of new to xml/kml/gdal/etc. Yes. I think the easiest way is to simply write a short XSL transform that you can filter your content through. You can use this to both combine your various KML outputs and change the dates (which come out as strings) to actual time stamps. I wrote something on the wiki about applying styles, but you could easily adapt this to whatever you need. http://trac.osgeo.org/gdal/wiki/KML -Chris Christopher Condit [email protected] (858) 822-5483 _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
