While there is not *native* support for KML yet, it is possible to generate it:

  1) via templates

  2) through straight mapscript (it ain't that complex) by writing your own xml

Here's an example of the former:

<!-- MapServer Template -->
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2";>
[resultset layer="shor_waspt3_query"]
  <Folder>
    <name>Water Access Points</name>
    <description>Water Access Points in Minnesota. Supplied by the Minnesota
    DNR, Division of Trails &amp; Waterways</description>
    [feature]<Placemark>
      <Point>
        <coordinates>[shpxy cs="," precision=6 
proj="+init=epsg:4326"]</coordinates>
      </Point>
      <name>[LAKENAME], [COUNTYNAME] County</name>
    </Placemark>
    [/feature]
  </Folder>
[/resultset]
</kml>

You'd have a corresponding output format in your mapfile, like so:

 OUTPUTFORMAT
    NAME 'kml'
    DRIVER 'TEMPLATE'
    MIMETYPE 'application/vnd.google-earth.kml+xml'
    FORMATOPTION 'attachement=wap.kml'
    FORMATOPTION 'FILE=/mytemplates/kml.xml'
  END

and can retrieve features via a normal query, like so:

  
http://maps.dnr.state.mn.us/cgi-bin/mapserv54?map=/usr/local/www/docs_maps/compass/compass_test.map&mode=nquery&qlayer=shor_waspt3_query&qformat=kml

This works well for place marks and outlines and you can combine multiple 
layers (as multiple folders) in one
output stream.

Steve

>>> On 4/8/2009 at 4:03 PM, in message
<[email protected]>, Tamas Szekeres
<[email protected]> wrote:
> Rendering as KML is not yet supported by MapServer, but these's an
> outstanding Google SoC project addressing this issue.
> 
> Best regards,
> 
> Tamas
> 
> 
> 
> 2009/4/8 Paul james <[email protected]>
> 
>> Hello...
>> Is it possible to get KML from Mapscript(c#) map?
>>
>> How?
>>
>> Thanks!
>>
>> _______________________________________________
>> mapserver-users mailing list
>> [email protected] 
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>>
>>

_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to