Re: IDL KML [message #67362 is a reply to message #67301] |
Tue, 14 July 2009 14:28   |
mankoff
Messages: 131 Registered: March 2004
|
Senior Member |
|
|
On Jul 12, 7:02 pm, mankoff <mank...@gmail.com> wrote:
> There have been a few discussion of KML on this list (one herehttp://tr.im/s2dQ). I'm wondering if anyone has gone further with this
> and has code willing to share. I've implemented five or six of the
> elements shown in the diagram herehttp://code.google.com/apis/kml/documentation/kmlreferen ce.html
> and thought I might not need to implement the entire schema if someone
> else has already done so. If not, I'm pleased to share what I have...
>
> -k.
Well this is my first major foray into IDL objects (not object
graphics). Past posts on this group have been very helpful regarding
private methods, singletons, object trees, etc.
I now have about 1/5th of the top image here
http://code.google.com/apis/kml/documentation/kmlreference.h tml
implemented in IDL objects. So far this means Folders and Placemarks.
Next comes GroundOverlays and TimeSpans.
Right now the following code works. It produces a KML file with 100
pins distributed at random lat,lon coords, and random altitudes, with
some of the pins floating and some extruded (a line down to the
earth). If anyone might find this useful let me know.
kml = obj_new('kdm_kml', file='test.kml')
d = obj_new( 'kdm_kml_document', visibility=1 )
f = obj_new( 'kdm_kml_folder', id='folder1', name='aFolder' )
d->add, f
for i = 0, 100 do begin
istr = STRING(i,FORMAT='(I03)')
p = obj_new('kdm_kml_placemark', $
id='Pid'+istr, $
latitude=randomn(seed,1)*90, $
longitude=randomu(seed,1)*360, $
x_altitudemode='relativeToGround', $
altitude=randomu(seed,1)*1e7, $
extrude=randomu(seed,1) gt 0.5, $
description='Some Text '+istr, $
name='Pid'+istr, $
visibility=1 )
f->add, p
endfor
kml->add, d
kml->saveKML
|
|
|