Re: Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92377 is a reply to message #92376] |
Fri, 04 December 2015 07:43   |
Steve[7]
Messages: 5 Registered: December 2015
|
Junior Member |
|
|
On Friday, 4 December 2015 13:57:09 UTC, David Fanning wrote:
> Steve writes:
>
>> I have created a reprojected MODIS true color image using the
> TrueColor package (ftp://ftp.ssec.wisc.edu/pub/IMAPP/MODIS/TrueColor/)
>>
>> I now want to read this image into IDL and overlay some data on top of the image e.g. an aircraft flight track. I am however having trouble getting the map projection correct.
>>
>> Note that the gpd file used in the TrueColor packaged to create the original image continas the following
>>
>> Map Projection: Azimuthal Equal-Area
>> Map Reference Latitude: 62.500
>> Map Reference Longitude: -10.000
>> Grid Map Units per Cell: 0.250
>> Grid Width: 4400.0
>> Grid Map Origin Column: 2199.5
>> Grid Height: 3400.0
>> Grid Map Origin Row: 1699.5
>>
>> I have tried the following code which attempts to use the method from David Fanning's page http://www.idlcoyote.com/ng_tips/mapnogrid.php
>>
>> ;read in original image
>> img = READ_TIFF('true.tif')
>> img = REVERSE(img,3)
>>
>> s=SIZE(img,/DIMENSIONS) ;3x4400x3400
>>
>> projection='Lambert Azimuthal'
>> latcen = 62.50
>> loncen = -10.0
>> res = 0.25
>>
>> map = Obj_New('cgMap', projection, /OnImage)
>> uv = map -> Forward(Loncen, Latcen)
>> uv_xcenter = uv[0,0]
>> uv_ycenter = uv[1,0]
>> xrange = [uv_xcenter - ((s[1]/2.)*res*1000.), uv_xcenter + ((s[1]/2.)*res*1000.)]
>> yrange = [uv_ycenter - ((s[2]/2.)*res*1000.), uv_ycenter + ((s[2]/2.)*res*1000.)]
>> map -> SetProperty, XRANGE=xrange, YRANGE=yrange
>> cgDisplay, s[1]/4., s[2]/4.
>> cgImage, img, Margin=0.1
>> map -> Draw
>> cgMap_Grid, MAP=map, /BOX_AXES, /cgGRID
>> cgMap_Continents, MAP=map, /continents, /hires
>>
>> The above code displays the original image on a map which looks about right. However the coastlines produced by cgMap_Continents do not overlay the real landmass boundaries in the original image. Clearly the map projection isn't quite correct.
>>
>> Until I get this sorted I can't overlay data onto the image.
>>
>> Any ideas on what I am doing wrong?
>
> It's hard to know without seeing the result, but I suspect you might
> have to shift your range by half a grid unit to match the grid origins.
>
> Cheers,
>
> David
>
> Cheers,
>
> David
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
So when I said the original image on the map looks about right I was perhaps being generous! The coastlines are offset in places by a few tenths of a degree latitude for example. Note that the grid unit is 250 metres so much smaller than this difference.
Perhaps I am making incorrect assumptions on what the image output by the TrueColor package contains i.e. the info in the gpd file is not sufficient.
Steve
|
|
|