GDAL Saves the Day Again
A piece of work I help out with involves the visualization and access of hydrometric monitoring data over the Web. Part of this involves the data management and publishing of voluminous databases of monitoring information.
We use Chameleon for basic visualization and query of the data. Behind the scenes, we run a slew of complex processes (shell scripts via cron) to output the data in a format that can be understood by MapServer (which we use to publish WMS layers). The processes work across many disparate database connections, so outputting them to shapefiles and accessing them locally helps with performance in web mapping apps. ogr2ogr is used exclusively and extensively for the access and format translation.
Well, today I found out that an effort began to write a bunch of scripts to additionally output OGC KML. Thank goodness things didn’t get very far, because the following addition to our processes:
$ ogr2ogr -F KML foo.kml bar.ovf -dsco NameField=NAME -dsco DescriptionField=COMMENT
…worked like a charm, and put a big smile on people’s faces!
So now, OGC KML is also supported for visualization in Earth browsers. Just like that.
Output styles are relatively simple; I’m thinking a -dsco like:
-dsco LayerStyle=LayerName,styles.kml#mystyle
…would point to an existing (local or remote) KML style document style ID via XPointer, i.e.:
<styleUrl>somefile.kml#mystyle</styleUrl>
Of course the default behaviour would be in place if this -dsco is not defined. I’ll see what the GDAL KML gurus think about this.
At any rate, once again, thank you GDAL for being an uber-utility for day-to-day GIS tasks. Happy faces everywhere!