<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hold it, stop, take a look at this first!<br>
<br>
This post was sent on the mapserver list last friday, please check if
this will your demands!<br>
<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.itopen.it/soluzioni/kml-map-server/">http://www.itopen.it/soluzioni/kml-map-server/</a><br>
<br>
<br>
<br>
Dylan Beaudette schreef:
<blockquote cite="mid:200709141108.53150.dylan.beaudette@gmail.com"
 type="cite">
  <pre wrap="">On Friday 14 September 2007, John Smith wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">as_kml()?! there's another askml() in line with asgml(). why this
alias/name change/confusion?

anyway how does it really work? getting a "Must contain
'geometry_column from table_name' or 'geom from (subselect) as foo'
(couldnt find ' from ')". what do i do after passing bbox=... and
type=kml to export script? the sql doesn't go inside .map, right? can
some share a detailed use/script? not much in
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/docs/postgis.pdf">http://postgis.refractions.net/docs/postgis.pdf</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->
I'll add a bit to this discussion, as I have tackled it before.

  </pre>
  <blockquote type="cite">
    <pre wrap="">btw super example at
<a class="moz-txt-link-freetext" 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>
07.9410234897,-132997.150403761,500000&layers=__base__ 
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Thanks! Here is a shorter link to the corresponding page:
<a class="moz-txt-link-freetext" href="http://casoilresource.lawr.ucdavis.edu/drupal/node/429">http://casoilresource.lawr.ucdavis.edu/drupal/node/429</a>

  </pre>
  <blockquote type="cite">
    <pre wrap="">although i didn't 
quite get this part:
1. select geometry overlapping the bounding box defined by the current
viewport in AEA coordinates, using the PostGIS spatial indexing system
2. compute the intersection between the boinding box and the
overlapping polygons
3. compute the centroids of the new geometry
4. convert the polygon geometry to KML
5. convert the centroid geometry to KML
6. return resulting text
    </pre>
  </blockquote>
  <pre wrap=""><!---->
This is a list of how the PHP code is functioning; some background--

I have a massive table of polygons, stored in a custom AEA projection. Google 
Earth is not happy about massive KML files, so PostGIS is used to 'cut-out' 
(intersection) a chunk. This chunk is then converted into KML, with all of 
the extra XML styling etc. added by a PHP wrapper script. A second pass is 
done with PostGIS to get the centroids of the polygons, which are used as a 
labeling mechanism. All of the KML / XML chunks are stuck into a dynamically 
generated KML document and returned to the user. 

I was able to construct this by
1. looking over the KML specs
2. looking at some example KML files
3. experimentation

Further work should definitely use something other than string functions to 
build the XML.

Another hint: be sure to send the KML header by PHP first:

                header("Pragma: public"); // required
                header("Expires: 0");       
                header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                header("Content-Type: application/kml; charset=utf8");
                header('Content-Disposition: attachment; filename="file.kml"') ;


check out the examples on the above link, and dissect the resulting KML file 
for hints.

Cheers,

Dylan





  </pre>
  <blockquote type="cite">
    <pre wrap="">cheers, jzs

On 9/14/07, Jose Gomez-Dans <a class="moz-txt-link-rfc2396E" href="mailto:jgomezdans@gmail.com"><jgomezdans@gmail.com></a> wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi Maciej,
I sent you an e-mail, but your spam protection system wouldn't allow
the message to go through.  If you have another address, I'll resend
it to you :)

On 9/14/07, Maciej Skorczewski <a class="moz-txt-link-rfc2396E" href="mailto:maciej.skorczewski@procad.pl"><maciej.skorczewski@procad.pl></a> wrote:
      </pre>
      <blockquote type="cite">
        <pre wrap="">how sql should looks like?
        </pre>
      </blockquote>
      <pre wrap="">Simply (and this is already quite advanced: you can use simplify() to
reduce the number of points in your vector data. Ours are very
detailed, and we don't want that on our KML files):

SELECT AS_KML(SIMPLIFY(the_geom,100)) from MY_TABLE;

      </pre>
      <blockquote type="cite">
        <pre wrap="">Question about Python class...i am not python programer can you
describe my how i can use it?
        </pre>
      </blockquote>
      <pre wrap="">You just write a small python program to use it. You should be able to
do the same with PHP.

Cheers,
José
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->


  </pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<title>3DSite</title>
<meta http-equiv="Content-Type" content="text/html; ">
<style type="text/css">
<!--
body {
        background-color: #FFFFFF;
        margin-left: 5px;
        margin-top: 5px;
        margin-right: 5px;
        margin-bottom: 5px;
}
body,td,th {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #333333;
}
.style4 {font-size: 9px; }
.style5 {font-size: 9px; color: #CCCCCC; }
-->
</style>
<meta content="MSHTML 6.00.2900.2912" name="GENERATOR">
<br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
  <tbody>
    <tr>
      <td rowspan="3" align="left" height="0" valign="bottom" width="15"><br>
      </td>
      <td colspan="2" align="left" height="78" valign="top" width="0">
      <p class="style4">Milo van der Linden
      <br>
      <a href="skype:milovanderlinden?add">skype: milovanderlinden</a><br>
      <a href="mailto:mlinden@zeelandnet.nl">mlinden@zeelandnet.nl</a><br>
      <a href="mailto:milovanderlinden@gmail.com">milovanderlinden@gmail.com</a><br>
      <a href="mailto:milo@3dsite.nl">milo@3dsite.nl</a><br>
      <a href="http://www.3dsite.nl">http://www.3dsite.nl</a><br>
      </p>
      </td>
      <td rowspan="3" align="left" height="0" valign="top" width="15"> </td>
      <td valign="top" width="300">
      <p class="style5"><span lang="NL">De informatie in dit bericht
reflecteert mijn persoonlijke mening en niet die van een bedrijf of
instantie. Aan de informatie kunnen geen rechten worden ontleend.
Indien dit bericht onderdeel is van een forum, mailing-list of
community dan gelden automatisch de bij het betreffende medium
behorende voorwaarden.</span>
      <span lang="EN">The information in this message reflects my
personal opinion and not that of a company or public body. All rights
reserved.If this message is contained in a mailing-list or community,
the rights on the medium are automatically adapted.</span></p>
      </td>
    </tr>
  </tbody>
</table>
</div>
</body>
</html>