GeoTiff- grid [message #58167] |
Mon, 21 January 2008 13:59  |
robinson.inj
Messages: 32 Registered: August 2007
|
Member |
|
|
Dear all,
I was wondering if someone can show me how to extract lat and lon
values for each pixel from a Geotiff image. Using ENVI i observed that
my results were horrible.
Thanks
Robinson.
|
|
|
|
|
|
|
Re: GeoTiff- grid [message #58246 is a reply to message #58167] |
Wed, 23 January 2008 07:15   |
robinson.inj
Messages: 32 Registered: August 2007
|
Member |
|
|
On Jan 23, 7:08 am, robinson....@gmail.com wrote:
> On Jan 22, 5:31 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>
>
>> Well, I tell you what. Here are the numbers I get when I use a
>> LAT=20 and LON=-96.5:
>
>> Corner Coordinates:
>> Upper Left: (-167346.019, 3677892.560)
>> Lower Left: (-167346.019, 2982923.485)
>> Upper Right: (1222592.132, 3677892.560)
>> Lower Right: (1222592.132, 2982923.485)
>> Corners in Lon/Lat
>> Upper Left: (-98.555, 51.338)
>> Lower Right: (-82.367, 45.408)
>
>> Here are the values I get (surprisingly close to
>> ENVI's) when I use a LON of 2, instead of 20:
>
>> Corner Coordinates:
>> Upper Left: (-167346.019, 3677892.560)
>> Lower Left: (-167346.019, 2982923.485)
>> Upper Right: (1222592.132, 3677892.560)
>> Lower Right: (1222592.132, 2982923.485)
>> Corners in Lon/Lat
>> Upper Left: (-98.037, 33.346)
>> Lower Right: (-85.323, 27.832)
>
>> Are you sure you did the ENVI numbers correctly?
>
>> Here is the way I set up the map projection:
>
>> map = MAP_PROJ_INIT(9, $
>> DATUM=5, $
>> CENTER_LAT=20.0, $
>> CENTER_LON=-96.5)
>> lonlat = MAP_PROJ_INVERSE([xorigin, xend],[yend, yorigin], $
>> MAP_STRUCTURE=map)
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming (www.dfanning.com)
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> strange. My map does not have any lat 2 value. converting the tiff
> image in a image with header i got:
>
> ENVI
> description = {
> File Resize Result, x resize factor: 1.000000, y resize factor:
> 1.000000.
> [Thu Jan 17 15:57:16 2008]}
> samples = 3000
> lines = 1500
> bands = 1
> header offset = 0
> file type = ENVI Standard
> data type = 2
> interleave = bsq
> sensor type = Unknown
> byte order = 0
> x start = 4380
> y start = 1880
> map info = {GEOTIFF (Mercator), 1.0000, 1.0000, -167346.0185,
> 3677892.5566, 4.6331271653e+002, 4.6331271653e+002, WGS-84,
> units=Meters}
> projection info = {20, 6378137.0, 6356752.3, 20.000000, -96.500000,
> 0.0, 0.0, WGS-84, GEOTIFF (Mercator), units=Meters}
> wavelength units = Unknown
> band names = {
> Resize (Band 1:MOD09GHK_A2005125_B4.tif)}- Hide quoted text -
>
> - Show quoted text -
David, using the GCTP keyword I solved the problem. Thank you very
much for all your assitance.
|
|
|
Re: GeoTiff- grid [message #58257 is a reply to message #58167] |
Wed, 23 January 2008 05:08   |
robinson.inj
Messages: 32 Registered: August 2007
|
Member |
|
|
On Jan 22, 5:31 pm, David Fanning <n...@dfanning.com> wrote:
> Well, I tell you what. Here are the numbers I get when I use a
> LAT=20 and LON=-96.5:
>
> Corner Coordinates:
> Upper Left: (-167346.019, 3677892.560)
> Lower Left: (-167346.019, 2982923.485)
> Upper Right: (1222592.132, 3677892.560)
> Lower Right: (1222592.132, 2982923.485)
> Corners in Lon/Lat
> Upper Left: (-98.555, 51.338)
> Lower Right: (-82.367, 45.408)
>
> Here are the values I get (surprisingly close to
> ENVI's) when I use a LON of 2, instead of 20:
>
> Corner Coordinates:
> Upper Left: (-167346.019, 3677892.560)
> Lower Left: (-167346.019, 2982923.485)
> Upper Right: (1222592.132, 3677892.560)
> Lower Right: (1222592.132, 2982923.485)
> Corners in Lon/Lat
> Upper Left: (-98.037, 33.346)
> Lower Right: (-85.323, 27.832)
>
> Are you sure you did the ENVI numbers correctly?
>
> Here is the way I set up the map projection:
>
> map = MAP_PROJ_INIT(9, $
> DATUM=5, $
> CENTER_LAT=20.0, $
> CENTER_LON=-96.5)
> lonlat = MAP_PROJ_INVERSE([xorigin, xend],[yend, yorigin], $
> MAP_STRUCTURE=map)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
strange. My map does not have any lat 2 value. converting the tiff
image in a image with header i got:
ENVI
description = {
File Resize Result, x resize factor: 1.000000, y resize factor:
1.000000.
[Thu Jan 17 15:57:16 2008]}
samples = 3000
lines = 1500
bands = 1
header offset = 0
file type = ENVI Standard
data type = 2
interleave = bsq
sensor type = Unknown
byte order = 0
x start = 4380
y start = 1880
map info = {GEOTIFF (Mercator), 1.0000, 1.0000, -167346.0185,
3677892.5566, 4.6331271653e+002, 4.6331271653e+002, WGS-84,
units=Meters}
projection info = {20, 6378137.0, 6356752.3, 20.000000, -96.500000,
0.0, 0.0, WGS-84, GEOTIFF (Mercator), units=Meters}
wavelength units = Unknown
band names = {
Resize (Band 1:MOD09GHK_A2005125_B4.tif)}
|
|
|
Re: GeoTiff- grid [message #58268 is a reply to message #58167] |
Tue, 22 January 2008 15:31   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Well, I tell you what. Here are the numbers I get when I use a
LAT=20 and LON=-96.5:
Corner Coordinates:
Upper Left: (-167346.019, 3677892.560)
Lower Left: (-167346.019, 2982923.485)
Upper Right: (1222592.132, 3677892.560)
Lower Right: (1222592.132, 2982923.485)
Corners in Lon/Lat
Upper Left: (-98.555, 51.338)
Lower Right: (-82.367, 45.408)
Here are the values I get (surprisingly close to
ENVI's) when I use a LON of 2, instead of 20:
Corner Coordinates:
Upper Left: (-167346.019, 3677892.560)
Lower Left: (-167346.019, 2982923.485)
Upper Right: (1222592.132, 3677892.560)
Lower Right: (1222592.132, 2982923.485)
Corners in Lon/Lat
Upper Left: (-98.037, 33.346)
Lower Right: (-85.323, 27.832)
Are you sure you did the ENVI numbers correctly?
Here is the way I set up the map projection:
map = MAP_PROJ_INIT(9, $
DATUM=5, $
CENTER_LAT=20.0, $
CENTER_LON=-96.5)
lonlat = MAP_PROJ_INVERSE([xorigin, xend],[yend, yorigin], $
MAP_STRUCTURE=map)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: GeoTiff- grid [message #58270 is a reply to message #58167] |
Tue, 22 January 2008 15:01   |
robinson.inj
Messages: 32 Registered: August 2007
|
Member |
|
|
On Jan 22, 4:47 pm, David Fanning <n...@dfanning.com> wrote:
> robinson....@gmail.com writes:
>> David, I followed your examples but still have problems. In the uv
>> space my corners IDL and ENVI aggred
>> UpperLeftCoordinate:(-167346.0185E, 3677892.5566N)
>> LowerRightCoordinate:(1222128.8184E,2983386.7945N)
>> My image has 3000 col x 1500 lin. The pix resolution is 463.3127
>> meters.
>
> I get an image resolution of 2999 x 1499 when I take
> the corner coordinates, subtract them, and divide
> by the pixel resolution. The fact that ENVI and IDL
> agree is a good thing, but in all of the GeoTIFF
> files I've been working, with doing this arithmetic
> gives me the image size exactly. So, that concerns
> me.
>
>> However in the lon/lat space i got:
>> IDL: UpperLeftCoordinate: (-98.555279E, 45.411655N)
>> LowerRightCoordinate: ( -81.568627E,51.346972N)
>> ENVI: UpperLeftCoordinate: (-98.09914722E, 33.30501389N)
>> LowerRightCoordinate:(-84.82142500E, 27.55810278N)
>
> Unless you are using the *completely* wrong map projection
> (how did you determine what this is?), then it looks to me
> like you didn't convert the corners you thought you were
> converting.
>
> But I would like to see the listgeo output to know
> what I am dealing with here.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
I posted the listgeo list above.
|
|
|
Re: GeoTiff- grid [message #58304 is a reply to message #58167] |
Thu, 24 January 2008 06:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
robinson.inj@gmail.com writes:
> Absolutly. I am very curious about that. but after 2 days trying to
> undertsand the big difference I am just going to use the GCTP keyword
> if I were in a boat :-).
I don't blame you. I think of Frank Worsley, navigating
for Shackleton, in a 20 foot open boat in the Southern
Ocean, trying to find South Georgia Island by dead reckoning.
I think he would use the GCTP keyword, too. :-)
I'll ask the map experts at work today to see if
they can come up with something.
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.")
|
|
|
Re: GeoTiff- grid [message #58305 is a reply to message #58167] |
Thu, 24 January 2008 06:29  |
robinson.inj
Messages: 32 Registered: August 2007
|
Member |
|
|
On Jan 24, 7:40 am, David Fanning <n...@dfanning.com> wrote:
> robinson....@gmail.com writes:
>> well, my 0.00000000001% was:
>> mrcMap=3Dmap_projetion_init('Mercator', DATUM=3D8, /GCTP, $
>> SEMIMAJOR_AXIS=3D0, SEMIMINOR_AXIS=3D0, $; porbably datum 8 deals
>> with this
>> CENTER_LONGITUDE=3D-96.5, TRUE_SCALE_LATITUDE=3D20, $
>> FALSE_EASTING=3D0, FALSE_NORTHING=3D0)
>
> Well, now. I think this is a *little* more important than
> that!
>
> Of course, I ran into the same problem. There are two
> "Mercator" projections available in IDL, and they take
> different keywords. Moreover, they give you results that
> differ by 20+ degrees of latitude. Aren't you just the
> least little bit curious about that? I know I am. :-)
>
> Plus, the one that apparently "works" is the one I can't
> get to work from my knowledge of what is in the GeoTiff
> file. It seems specialized knowledge has been called into
> play here. I'd like to know how I was suppose to discover
> that. Anyone have any ideas?
>
> 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.")
Absolutly. I am very curious about that. but after 2 days trying to
undertsand the big difference I am just going to use the GCTP keyword
if I were in a boat :-).
I think that in IDL mercator the center_LATITUDE must be located into
the image. However I can dicide to cut the image if it were too big. I
took a short latitude range from a big image (by preserving the same
longitude range). Probably USGS mercator (GCTP) have already thought
about this possibility. It is just a idea.
|
|
|
Re: GeoTiff- grid [message #58307 is a reply to message #58167] |
Thu, 24 January 2008 05:40  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
robinson.inj@gmail.com writes:
> well, my 0.00000000001% was:
> mrcMap=3Dmap_projetion_init('Mercator', DATUM=3D8, /GCTP, $
> SEMIMAJOR_AXIS=3D0, SEMIMINOR_AXIS=3D0, $; porbably datum 8 deals
> with this
> CENTER_LONGITUDE=3D-96.5, TRUE_SCALE_LATITUDE=3D20, $
> FALSE_EASTING=3D0, FALSE_NORTHING=3D0)
Well, now. I think this is a *little* more important than
that!
Of course, I ran into the same problem. There are two
"Mercator" projections available in IDL, and they take
different keywords. Moreover, they give you results that
differ by 20+ degrees of latitude. Aren't you just the
least little bit curious about that? I know I am. :-)
Plus, the one that apparently "works" is the one I can't
get to work from my knowledge of what is in the GeoTiff
file. It seems specialized knowledge has been called into
play here. I'd like to know how I was suppose to discover
that. Anyone have any ideas?
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.")
|
|
|
Re: GeoTiff- grid [message #58312 is a reply to message #58234] |
Wed, 23 January 2008 23:35  |
robinson.inj
Messages: 32 Registered: August 2007
|
Member |
|
|
On Jan 23, 1:00 pm, David Fanning <n...@dfanning.com> wrote:
> robinson....@gmail.com writes:
>> hey, 99.99999999999% i did was based on your article :-)
>
> Yes, but my results didn't match ENVI's. (They were
> off by 20+ degrees of latitude. A considerable
> distance if you are in a boat searching for land.)
>
> How did you resolve that little problem? :-)
>
> 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.")
well, my 0.00000000001% was:
mrcMap=map_projetion_init('Mercator', DATUM=8, /GCTP, $
SEMIMAJOR_AXIS=0, SEMIMINOR_AXIS=0, $; porbably datum 8 deals
with this
CENTER_LONGITUDE=-96.5, TRUE_SCALE_LATITUDE=20, $
FALSE_EASTING=0, FALSE_NORTHING=0)
|
|
|