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

Home » Public Forums » archive » ENVI Vector File with IDL
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
ENVI Vector File with IDL [message #48357] Thu, 13 April 2006 11:33 Go to next message
rafaloos is currently offline  rafaloos
Messages: 15
Registered: January 2006
Junior Member
I am trying to create an Envi Vector File (EVF) with IDL.
ENVI has a funciton for doing that and also gives an example on how to
create a PRO file.

Here is a small piece of the code:

pro create_new_evf_file
;
; Create a Geographic projection
; with the default datum and units.
;
proj = envi_proj_create(/geographic)
;
; Define a polyline vector in Lat/Lon coordinates
;
polyline = [ $
-106.904, 41.5887, $
-106.821, 42.2302, $
-106.013, 42.2183, $
; ..........
; Initialize the new EVF file
;
evf_ptr = envi_evf_define_init('sample.evf', $
projection=proj, data_type=4, $
layer_name='Sample EVF File')
;...........


How can I call that ENVI_PROJ_CREATE function with IDL?
If I try to run the code as it is, I receive this message from IDL:

proj = envi_proj_create(/geographic)
^
% Syntax error.

Thanks
Re: ENVI Vector File with IDL [message #48423 is a reply to message #48357] Fri, 14 April 2006 13:47 Go to previous message
rafaloos is currently offline  rafaloos
Messages: 15
Registered: January 2006
Junior Member
..the compile_opt idl2 solved the problem ...

Thanks AEO and everybody that replied my message.
Re: ENVI Vector File with IDL [message #48424 is a reply to message #48357] Fri, 14 April 2006 13:46 Go to previous message
rafaloos is currently offline  rafaloos
Messages: 15
Registered: January 2006
Junior Member
..the compile_opt idl2 solved the problem ...

Thanks AEO and everybody that replied my message.
Re: ENVI Vector File with IDL [message #48425 is a reply to message #48357] Fri, 14 April 2006 13:41 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
AEO wrote:
> Try putting "compile_opt idl2" at the top of your program :

Ah yes, of course. I should have a "compile_opt strictarr" key to save
me from repetitive stress injuries caused by typing it so many times.

Mike
--
www.michaelgalloy.com
Re: ENVI Vector File with IDL [message #48426 is a reply to message #48357] Fri, 14 April 2006 13:30 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
rafaloos@gmail.com wrote:
> Hi Michael ...
> You mean this lines ?
>
> envi, /restore_base_save_files
> envi_batch_init, log_file='~/Desktop/batch.txt'
>
> I did that ... but still .. IDL complains ...
> If I run the routine through the ENVI prompt it works ... but it
> doesn't work if I only use IDL without starting the ENVI software.
>
> Thanks
>

Yes, when I do that, everything seems to work (see below). Is there
anything in your log file?

IDL> envi, /restore_base_save_files
% Restored file: ENVI.
% Restored file: ENVI_M01.
% Restored file: ENVI_M02.
% Restored file: ENVI_M03.
% Restored file: ENVI_M04.
% Restored file: ENVI_M05.
% Restored file: ENVI_M06.
% Restored file: ENVI_M07.
% Restored file: ENVI_M08.
% Restored file: ENVI_D01.
% Restored file: ENVI_D02.
% Restored file: ENVI_D03.
% Restored file: ENVI_CW.
% Restored file: ENVI_IDL.
% Restored file: ENVI_IOU.
IDL> envi_batch_init, log_file='~/Desktop/batch.txt'
IDL> proj = envi_proj_create(/geographic)
IDL> help, proj
PROJ STRUCT = -> ENVI_PROJ_STRUCT Array[1]
IDL> help, proj, /structure
** Structure ENVI_PROJ_STRUCT, 6 tags, length=156, data length=150:
NAME STRING 'Geographic Lat/Lon'
TYPE INT 1
PARAMS DOUBLE Array[15]
UNITS INT 6
DATUM STRING 'WGS-84'
USER_DEFINED INT 0


Mike
--
www.michaelgalloy.com
Re: ENVI Vector File with IDL [message #48427 is a reply to message #48357] Fri, 14 April 2006 13:22 Go to previous message
AEO is currently offline  AEO
Messages: 5
Registered: September 2003
Junior Member
Try putting "compile_opt idl2" at the top of your program :

PRO test
compile_opt idl2
proj = envi_proj_create(/geographic)
END

ENVI_PROJ_CREATE is not a recognized internal IDL function, so when you
go to compile it treats it as a variable that is being subscripted, so
the "/" character causes a syntax error.

- AEO
Re: ENVI Vector File with IDL [message #48428 is a reply to message #48357] Fri, 14 April 2006 13:04 Go to previous message
rafaloos is currently offline  rafaloos
Messages: 15
Registered: January 2006
Junior Member
Hi Michael ...
You mean this lines ?

envi, /restore_base_save_files
envi_batch_init, log_file='~/Desktop/batch.txt'

I did that ... but still .. IDL complains ...
If I run the routine through the ENVI prompt it works ... but it
doesn't work if I only use IDL without starting the ENVI software.

Thanks
Re: ENVI Vector File with IDL [message #48429 is a reply to message #48357] Fri, 14 April 2006 12:19 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
rafaloos@gmail.com wrote:
> I was wondering what I should do to make this PRO example to work with
> IDL.

And just to be sure, you've initializing ENVI in batch mode before this
call?

-Mike
michaelgalloy.com
Re: ENVI Vector File with IDL [message #48432 is a reply to message #48357] Fri, 14 April 2006 11:03 Go to previous message
David Streutker is currently offline  David Streutker
Messages: 34
Registered: June 2005
Member
Ah, I understand.

I don't see anything wrong with your projection calls. However, I
believe your polyline needs to be a [2,n] array, not a [1,n] as is
shown in your example.

polyline = [ $
[-106.904, 41.5887], $
[-106.821, 42.2302], $
[-106.013, 42.2183], $
..........

With this change, it works for me.

-David
Re: ENVI Vector File with IDL [message #48434 is a reply to message #48357] Fri, 14 April 2006 10:27 Go to previous message
rafaloos is currently offline  rafaloos
Messages: 15
Registered: January 2006
Junior Member
Hi, David...
I have an ENVI license. That is not the problem. The problem is that
the way this routines are being called, IDL complains that there are
some syntax errors, e.g the equal signs (projection=proj) :

evf_ptr = envi_evf_define_init('sample.evf', $
projection=proj, data_type=4, $
layer_name='Sample EVF File')

I was wondering what I should do to make this PRO example to work with
IDL.

Thanks
Re: ENVI Vector File with IDL [message #48437 is a reply to message #48357] Fri, 14 April 2006 08:05 Go to previous message
David Streutker is currently offline  David Streutker
Messages: 34
Registered: June 2005
Member
Are you saying that ENVI_PROJ_CREATE doesn't work for you because you
don't have an ENVI license? Because if that's the case, then none of
the ENVI_EVF_* routines are going to be available to you either.

-David
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Free source code diagramming programs
Next Topic: Uniting IDL and Matlab

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

Current Time: Wed Oct 08 09:22:49 PDT 2025

Total time taken to generate the page: 0.00700 seconds