<a href="http://www.bostongis.com/PrinterFriendly.aspx?content_name=ogr_cheatsheet">http://www.bostongis.com/PrinterFriendly.aspx?content_name=ogr_cheatsheet</a><br><br>I use ogr2ogr for doing that..  however sometimes its best to write the KML using your own structure, descriptions, and element names.
<br><br><a href="http://www.gdal.org/ogr/drv_kml.html">http://www.gdal.org/ogr/drv_kml.html</a> will describe the options that let you name the KML elements based off of a database fields data.<br><br><div><span class="gmail_quote">
On 9/14/07, <b class="gmail_sendername">Dylan Beaudette</b> <<a href="mailto:dylan.beaudette@gmail.com">dylan.beaudette@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Friday 14 September 2007, John Smith wrote:<br>> as_kml()?! there's another askml() in line with asgml(). why this<br>> alias/name change/confusion?<br>><br>> anyway how does it really work? getting a "Must contain
<br>> 'geometry_column from table_name' or 'geom from (subselect) as foo'<br>> (couldnt find ' from ')". what do i do after passing bbox=... and<br>> type=kml to export script? the sql doesn't go inside .map, right? can
<br>> some share a detailed use/script? not much in<br>> <a href="http://postgis.refractions.net/docs/postgis.pdf">http://postgis.refractions.net/docs/postgis.pdf</a><br><br>I'll add a bit to this discussion, as I have tackled it before.
<br><br>> btw super example at<br>> <a href="http://casoilresource.lawr.ucdavis.edu/ka-map/htdocs/?map=casoil&cps=-20125">http://casoilresource.lawr.ucdavis.edu/ka-map/htdocs/?map=casoil&cps=-20125</a><br>>
07.9410234897,-132997.150403761,500000&layers=__base__<br><br>Thanks! Here is a shorter link to the corresponding page:<br><a href="http://casoilresource.lawr.ucdavis.edu/drupal/node/429">http://casoilresource.lawr.ucdavis.edu/drupal/node/429
</a><br><br>>although i didn't<br>> quite get this part:<br>> 1. select geometry overlapping the bounding box defined by the current<br>> viewport in AEA coordinates, using the PostGIS spatial indexing system
<br>> 2. compute the intersection between the boinding box and the<br>> overlapping polygons<br>> 3. compute the centroids of the new geometry<br>> 4. convert the polygon geometry to KML<br>> 5. convert the centroid geometry to KML
<br>> 6. return resulting text<br><br>This is a list of how the PHP code is functioning; some background--<br><br>I have a massive table of polygons, stored in a custom AEA projection. Google<br>Earth is not happy about massive KML files, so PostGIS is used to 'cut-out'
<br>(intersection) a chunk. This chunk is then converted into KML, with all of<br>the extra XML styling etc. added by a PHP wrapper script. A second pass is<br>done with PostGIS to get the centroids of the polygons, which are used as a
<br>labeling mechanism. All of the KML / XML chunks are stuck into a dynamically<br>generated KML document and returned to the user.<br><br>I was able to construct this by<br>1. looking over the KML specs<br>2. looking at some example KML files
<br>3. experimentation<br><br>Further work should definitely use something other than string functions to<br>build the XML.<br><br>Another hint: be sure to send the KML header by PHP first:<br><br>                header("Pragma: public"); // required
<br>                header("Expires: 0");<br>                header("Cache-Control: must-revalidate, post-check=0, pre-check=0");<br>                header("Content-Type: application/kml; charset=utf8");
<br>                header('Content-Disposition: attachment; filename="file.kml"') ;<br><br><br>check out the examples on the above link, and dissect the resulting KML file<br>for hints.<br><br>Cheers,<br>
<br>Dylan<br><br><br><br><br><br>> cheers, jzs<br>><br>> On 9/14/07, Jose Gomez-Dans <<a href="mailto:jgomezdans@gmail.com">jgomezdans@gmail.com</a>> wrote:<br>> > Hi Maciej,<br>> > I sent you an e-mail, but your spam protection system wouldn't allow
<br>> > the message to go through.  If you have another address, I'll resend<br>> > it to you :)<br>> ><br>> > On 9/14/07, Maciej Skorczewski <<a href="mailto:maciej.skorczewski@procad.pl">maciej.skorczewski@procad.pl
</a>> wrote:<br>> > > how sql should looks like?<br>> ><br>> > Simply (and this is already quite advanced: you can use simplify() to<br>> > reduce the number of points in your vector data. Ours are very
<br>> > detailed, and we don't want that on our KML files):<br>> ><br>> > SELECT AS_KML(SIMPLIFY(the_geom,100)) from MY_TABLE;<br>> ><br>> > > Question about Python class...i am not python programer can you
<br>> > > describe my how i can use it?<br>> ><br>> > You just write a small python program to use it. You should be able to<br>> > do the same with PHP.<br>> ><br>> > Cheers,<br>> > José
<br>><br>> _______________________________________________<br>> postgis-users mailing list<br>> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">
http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br><br><br><br>--<br>Dylan Beaudette<br>Soils and Biogeochemistry Graduate Group<br>University of California at Davis<br>530.754.7341<br>_______________________________________________
<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users
</a><br></blockquote></div><br>