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

Home » Public Forums » archive » Re: Map Projection Conversion in ENVI
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
Re: Map Projection Conversion in ENVI [message #66876] Fri, 19 June 2009 00:58
lbusett@yahoo.it is currently offline  lbusett@yahoo.it
Messages: 30
Registered: February 2006
Member
On 18 Giu, 00:49, David Fanning <n...@dfanning.com> wrote:
> Folks,
>
> OK, I am at wit's end here.
>
> I have opened a MISR image in ENVI. I've used blocks 10-35,
> so this image is roughly over the Arctic Ocean. The
> image is georeferenced to a Space Oblique Mercator
> map projection. All well and good. The image runs
> through (and extends outside) a rectangular grid I
> am using for a study area.
>
> I now wish to convert this image to a Lambert's Equal
> Area projection, using a particular 500m grid that represents
> my study area. (The original data is on a 275m grid.) I
> can successfully use the Convert Map Projection selection
> from under the Map menu to do this. I select the new
> projection, give it the map coordinates (in my grid) of the (0,0)
> pixel in the image (-1440000.0 and 2310537.95),
> specify the output pixel sizes (500 m in both directions),
> give it the dimensions of my output image (5760 by 4800),
> and tell it to do a rigorous nearest neighbor regridding.
> ENVI does its thing, and it works great. I'm happy.
>
> But setting all this map conversion malarkey up is labor
> intensive, and I would like to avoid it, since I have
> a rather goodly number of images and I have no wish to
> spend a week or so in this mindless and mind-numbing
> behavior.
>
> So I wrote an ENVI batch file (where I ran into the afore-
> mentioned "array dimension zero" problem) and off ENVI
> goes, but this time using Envi_Convert_File_Map_Projection.
>
> mapStruct = Envi_Proj_Create(TYPE=36, NAME='fanningStudy', $
>    PARAMS=[6370997.0D, 90.0, 0.0, 0.0, 0.0])
> Envi_Convert_File_Map_projection, DIMS=dims, R_FID=fID, $
>    O_PIXEL_SIZE=[500,500], OUT_BNAME=bnames, OUT_NAME=out_name, $
>    O_PROJ=mapStruct, RESAMPLING=0, WARP_METHOD=3, POS=[0,1,2,3]
>
> It actually seems to warp the image correctly. Except that my
> output is not 5760 x 4800. It is 7993 x 5668. And the
> map coordinates of the (0,0) pixel are -2340960 and
> 2213641, not -1440000 and 2310538. It appears as though the
> *entire* original image has been mapped to the new projection
> but not clipped to my actual grid area as it was when
> I did the conversion manually.
>
> Does anyone know how I can confine the image to just that
> part of the map projection I am interested in? Any image
> pixels outside the region I am happy to throw away.
>
> In other words, I need some way to tell my image that I am
> only interested in pixels that start (in X) at -1440000
> and that start in Y at 2310538 -(4800*500).
>
> I see there is a Envi_Map_Info_Create routine that allows
> me to actually use these numbers, but I don't see how to
> use such a thing during the map conversion:
>
>   mapInfo = Envi_Map_Info_Create(PROJ=mapStruct, $
>      MC=[0d, 0d, -1440000.0d, 2310537.95d], $
>      PS=[5760,4800], NAME='fanningStudy')
>
> Ideas certainly appreciated. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Hi David,

if I understand well your problem, a possible workaround could be
to use the ENVI_LAYER_STACKING_DOIT envi routine, which according to
ENVI help:

"builds a new multi-band file from georeferenced images of various
pixel sizes, extents, and projections. The input bands will be
resampled and reprojected to a common output projection and pixel
size.The output file will contain only data based on the map extent of
the input images. You can select either an inclusive (encompass all
the files) or exclusive (encompass file overlap) output image.
"

You could build a "dummy" image with the spatial resolution,
projection and extent that you need, and then use
ENVI_LAYER_STACKING_DOIT with the \EXCLUSIVE option to resample and
reproject the MISR image on the grid extent of the dummy image.
Unfortunately, the output will contain both the dummy image (in the
first band), and the resampled and reprojected MISR data, so that you
will have to remove the first band from the output with "resize_doit"
or similar routines.

I did not test this solution, but I think that it could work.

Hope this helps,

Lorenzo
Re: Map Projection Conversion in ENVI [message #66913 is a reply to message #66876] Thu, 18 June 2009 06:33 Go to previous message
wita is currently offline  wita
Messages: 43
Registered: January 2005
Member
Hi David,

I recognize your problem, but I have no solution other then the one
Jeff is offering. Although that may be not too much work if you just
use an ENVI_GET_DATA with the DIMS keyword to get the subset you need.

What has surprised me is that ENVI offers an option 'Match existing
file' in the map conversion menus with is very convenient for this
kind of work. But so far I never managed to find out how to do this
programmatically. There may be an undocumented feature in the
ENVI_CONVERT_FILE_MAP_PROJECTION routine which allows this. Maybe
someone from ITTVIS could shed some light on this issue?

Allard
Re: Map Projection Conversion in ENVI [message #66917 is a reply to message #66913] Wed, 17 June 2009 17:50 Go to previous message
jeffnettles4870 is currently offline  jeffnettles4870
Messages: 111
Registered: October 2006
Senior Member
David,

One potential solution is to take the four corners of your study area
and do something like this:

1. convert them to the new projection with
envi_convert_projection_coordinates

2. then convert them to pixel coordinates with
envi_convert_file_coordinates, then

3. subset your image with the pixel coordinates using array
operations.

Probably more cumbersome than you were looking for, but seems to me
like it should work.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Problems with tying ROI's to image
Next Topic: Re: matrix - element extraction

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

Current Time: Wed Oct 08 16:49:20 PDT 2025

Total time taken to generate the page: 0.00626 seconds