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
|