My favorites | Sign in
Project Home Wiki Issues Source
Search
for
KML  
Description of the KDM_KML suite
Featured
Updated Jul 23, 2009 by mank...@gmail.com

Introduction

http://code.google.com/apis/kml/documentation/kmlreference.html

Examples

Placemark Example

<Placemark>
  <name>Google Earth - New Placemark</name>
  <description>Some Descriptive text.</description>
  <LookAt>
    <longitude>-90.86879847669974</longitude>
    <latitude>48.25330383601299</latitude>
    <range>440.8</range>
    <tilt>8.3</tilt>
    <heading>2.7</heading>
  </LookAt>
  <Point>
    <coordinates>-90.86948943473118,48.25450093195546,0</coordinates>
  </Point>
</Placemark>

Becomes:

kml = obj_new('kdm_kml', filename='test.kml' )
doc = obj_new('kdm_kml_document')
placemark = obj_new('kdm_kml_placemark, $
    name='Google Earth - New Placemark', $
    description='Some Descriptive text.', $
    lat=-90.86, lon=48.25 )
doc->add, placemark
kml->add, doc
kml->kmlSave, /kmz, /openGE

Reference: http://code.google.com/apis/kml/documentation/kmlreference.html#placemark

BalloonStyle Example

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
  <name>BalloonStyle.kml</name>
  <open>1</open>
  <Style id="exampleBalloonStyle">
    <BalloonStyle>
      <!-- a background color for the balloon -->
      <bgColor>ffffffbb</bgColor>
      <!-- styling of the balloon text -->
      <text><![CDATA[
      <b><font color="#CC0000" size="+3">$[name]</font></b>
      <br/><br/>
      <font face="Courier">$[description]</font>
      <br/><br/>
      Extra text that will appear in the description balloon
      <br/><br/>
      <!-- insert the to/from hyperlinks -->
      $[geDirections]
      ]]></text>
    </BalloonStyle>
  </Style>
  <Placemark>
    <name>BalloonStyle</name>
    <description>An example of BalloonStyle</description>
    <styleUrl>#exampleBalloonStyle</styleUrl>
    <Point>
      <coordinates>-122.370533,37.823842,0</coordinates>
    </Point>
  </Placemark>
</Document>
</kml>

Becomes:

kml = obj_new('kdm_kml', file='test.kml')
d = obj_new( 'kdm_kml_document', visibility=1, name="BalloonStyle.kml", open=1 )

st = obj_new('kdm_kml_style', id='exampleBalloonStyle')
bs = obj_new( 'kdm_kml_balloonstyle', $
              bgcolor='ffffffbb', $
              text=kdm_cdata( '<b><font color="#CC0000" size="+3">$[name]</font></b>' + $
                              '<br/><br/>' + $
                              '<font face="Courier">$[description]</font>' + $
                              '<br/><br/>' + $
                              'Extra text that will appear in the description balloon' + $
                              '<br/><br/>' + $
                              '<!-- insert the to/from hyperlinks -->' + $
                              '<!-- $[geDirections] -->' ) $
              )
p = obj_new( 'kdm_kml_placemark', lon=-122.370533, lat=37.823842, alt=0, $
             name='BalloonStyle', styleURL='#exampleBalloonStyle', $
             description='An example of a BalloonStyle', open=1, snippet=0 )

kml->add, d
d->add, st
st->add, bs
d->add, p

Reference: http://code.google.com/apis/kml/documentation/kmlreference.html#balloonstyle


Sign in to add a comment
Powered by Google Project Hosting