X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 12 Mar 2009 09:10 AM by  Deleted User
Problem in georeferencing images with envi_glt_doit,
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Deleted User



New Member


Posts:
New Member


--
12 Mar 2009 09:10 AM
    Hi all, i am experimenting problems writing a code to georeference MODIS DATA.

    I copy and paste the code “example_glt_usage” from ENVI help in the IDL soft 6.2, I change the "[ ]", and I compile and run the code, then I select the images and next the runtime halt with the message error:
    “envi_built_glt_doit: An error has occurred during processing”

    Error: “Attempt to subscript DXS with is out of range.” The result may be invalid.
     
    Some one experimented these error? I attach the code in the bottom..
    thanks,
    Javier
     
    pro modis_geop1, ev

    ;compile_opt strictarr 

     

    ;  Select an image and it's associated input geometry. 

    envi_select, title='Please select an image to georeference', $ 

       dims=dims, fid=fid, pos=pos 

    if fid eq -1 then return 

    envi_select, title='Please select the longitude band', $ 

       fid=x_fid, dims=dims, pos=x_pos, /band_only, /no_dims 

    if x_fid eq -1 then return 

    envi_select, title='Please select the latitude band', $ 

       fid=y_fid, dims=dims, pos=y_pos, /band_only, /no_dims 

    if y_fid eq -1 then return 

     

    ;  Figure out what UTM zone we're in. 

    ;query_dims = [-1L, long(dims[2]/2), long(dims[2]/2), long(dims[4]/2), long(dims[4]/2)] 

    ;lat_lon = [envi_get_data(fid=y_fid, dims=query_dims, pos=y_pos), $ 

    ;               envi_get_data(fid=x_fid, dims=query_dims, pos=x_pos)] 

    ;zone = fix(31.0 + lat_lon[1]/6.0) 

    ;south = (lat_lon[0] lt 0) 

     

    ;  Make the GLT. 

    envi_file_query, fid, sname=sname 

    out_name=sname+'_glt' 

    pixel_size=1000.0D 

    rotation=0.0 

    i_proj = envi_proj_create(/geographic) 

    o_proj = envi_proj_create(/geographic) 

    envi_glt_doit, i_proj=i_proj, $ 

       o_proj=o_proj, out_name=out_name, $ 

       pixel_size=pixel_size, r_fid=glt_fid, $ 

       rotation=rotation, x_fid=x_fid, y_fid=y_fid, $ 

       x_pos=x_pos, y_pos=y_pos 

    if glt_fid eq -1 then return 

     

    ;  Georeference the image from the GLT. 

    out_name=sname+'_georef' 

    envi_doit, 'envi_georef_from_glt_doit', fid=fid, $ 

       glt_fid=glt_fid, out_name=out_name, pos=pos, $ 

       subset=dims, r_fid=r_fid 

     

    end
     

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    12 Mar 2009 11:29 AM
    I think the problem is that you are setting the output projection to geographic but the pixel size to 1000m.  The geographic projection takes pixel size in degrees.  Better yet, output to a projection like UTM and set the pixel size to 1000m.  You don't have to set the output pixel size at all.  The routine can estimate this for you.

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 Mar 2009 04:16 PM
    Thanks very much, I appreciate your answer, I make the correction that you suggest and the code works perfectly, thank again, Javier.   [QUOTE]mminari wrote I think the problem is that you are setting the output projection to geographic but the pixel size to 1000m.  The geographic projection takes pixel size in degrees.  Better yet, output to a projection like UTM and set the pixel size to 1000m.  You don't have to set the output pixel size at all.  The routine can estimate this for you. [/QUOTE]
    You are not authorized to post a reply.