ENVI Vector File with IDL [message #48357] |
Thu, 13 April 2006 11:33  |
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 #48425 is a reply to message #48357] |
Fri, 14 April 2006 13:41  |
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  |
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  |
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  |
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 #48432 is a reply to message #48357] |
Fri, 14 April 2006 11:03  |
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  |
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  |
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
|
|
|