comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Creating KML error
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Creating KML error [message #91439] Wed, 15 July 2015 06:38 Go to next message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Hi guys,

What am I doing wrong:

plot=plot([!values.f_nan],[!values.f_nan], xrange=[-50,-40], yrange=[70,80])
ax = plot.axes
ax[0].hide = 1
ax[1].hide = 1
ax[2].hide = 1
ax[3].hide = 1

poly=polygon([-47,-43,-43,-47,-47],[72.5,72.5,77.5,77.5,72.5 ],/data,color='black')
poly.save, 'square.kml'

% SAVE: Error writing file Expression must be a structure in this context:
SMAP.

Even when I try "plot.save, 'square.kml'" I get the same error...

help, !version, /str
** Structure !VERSION, 8 tags, length=104, data length=100:
ARCH STRING 'x86_64'
OS STRING 'linux'
OS_FAMILY STRING 'unix'
OS_NAME STRING 'linux'
RELEASE STRING '8.4'
BUILD_DATE STRING 'Sep 27 2014'
MEMORY_BITS INT 64
FILE_OFFSET_BITS
INT 64

Thank you in advance for your help,
nata
Re: Creating KML error [message #91442 is a reply to message #91439] Wed, 15 July 2015 11:49 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 7/15/15 7:38 AM, nata wrote:
> Hi guys,
>
> What am I doing wrong:
>
> plot=plot([!values.f_nan],[!values.f_nan], xrange=[-50,-40], yrange=[70,80])
> ax = plot.axes
> ax[0].hide = 1
> ax[1].hide = 1
> ax[2].hide = 1
> ax[3].hide = 1
>
> poly=polygon([-47,-43,-43,-47,-47],[72.5,72.5,77.5,77.5,72.5 ],/data,color='black')
> poly.save, 'square.kml'
>
> % SAVE: Error writing file Expression must be a structure in this context:
> SMAP.
>
> Even when I try "plot.save, 'square.kml'" I get the same error...
>
> help, !version, /str
> ** Structure !VERSION, 8 tags, length=104, data length=100:
> ARCH STRING 'x86_64'
> OS STRING 'linux'
> OS_FAMILY STRING 'unix'
> OS_NAME STRING 'linux'
> RELEASE STRING '8.4'
> BUILD_DATE STRING 'Sep 27 2014'
> MEMORY_BITS INT 64
> FILE_OFFSET_BITS
> INT 64
>
> Thank you in advance for your help,
> nata

I'm not sure, but it would make sense to me if KML/KMZ output was only
available from MAP.

In any case, a better error message would be useful.

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Re: Creating KML error [message #91487 is a reply to message #91442] Mon, 20 July 2015 11:20 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, July 15, 2015 at 12:49:26 PM UTC-6, Michael Galloy wrote:
> On 7/15/15 7:38 AM, nata wrote:
>> Hi guys,
>>
>> What am I doing wrong:
>>
>> plot=plot([!values.f_nan],[!values.f_nan], xrange=[-50,-40], yrange=[70,80])
>> ax = plot.axes
>> ax[0].hide = 1
>> ax[1].hide = 1
>> ax[2].hide = 1
>> ax[3].hide = 1
>>
>> poly=polygon([-47,-43,-43,-47,-47],[72.5,72.5,77.5,77.5,72.5 ],/data,color='black')
>> poly.save, 'square.kml'
>>
>> % SAVE: Error writing file Expression must be a structure in this context:
>> SMAP.
>>
>> Even when I try "plot.save, 'square.kml'" I get the same error...
>>
>> help, !version, /str
>> ** Structure !VERSION, 8 tags, length=104, data length=100:
>> ARCH STRING 'x86_64'
>> OS STRING 'linux'
>> OS_FAMILY STRING 'unix'
>> OS_NAME STRING 'linux'
>> RELEASE STRING '8.4'
>> BUILD_DATE STRING 'Sep 27 2014'
>> MEMORY_BITS INT 64
>> FILE_OFFSET_BITS
>> INT 64
>>
>> Thank you in advance for your help,
>> nata
>
> I'm not sure, but it would make sense to me if KML/KMZ output was only
> available from MAP.
>
> In any case, a better error message would be useful.
>
> Mike
> --
> Michael Galloy
> www.michaelgalloy.com
> Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)

Okay, this is now fixed. If you want to apply the patch yourself, just open up lib/itools/components/idlitwritekml__define.pro

Around line 825, change:
if(~isZ) then begin
to:
if(~isZ && N_TAGS(sMap) gt 0) then begin

Then, around line 883, change:
ppoints[*,i] = points[*,conn[npoints+i+1]]
to:
ppoints[*,i] = points[0:isZ ? 2 : 1,conn[npoints+i+1]]

That's it! Now I have a nice square polygon in the middle of Greenland.

Cheers,
Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Adding arrays
Next Topic: Writing .mat files in IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:16:23 PDT 2025

Total time taken to generate the page: 0.00470 seconds