[mapserver-users] KML for mapscript Map...
Steve Lime
Steve.Lime at dnr.state.mn.us
Wed Apr 8 14:32:46 PDT 2009
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 & 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
<f3b73b7d0904081403s75aebc2fh174d0e525bfe8dde at mail.gmail.com>, Tamas Szekeres
<szekerest at gmail.com> 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 <pauljame at gmail.com>
>
>> Hello...
>> Is it possible to get KML from Mapscript(c#) map?
>>
>> How?
>>
>> Thanks!
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
More information about the MapServer-users
mailing list