18 Jan 2016 02:50 PM |
|
Dear experts,
I am reading a GeoTIFF file to create and ENVI file. I have some trouble getting the header information right.
In a typical ENVI header, the map info string looks like this:
map info = {UTM, 1, 1, 145185, 2189715, 30, 30, 19, North}
I don't understand the usage of the elements 2,3 in this string, both of which are 1. It is described as reference x,y points in file coordinates in the documentations. I don't see any value from GeoTIFF files that resembles these. How should i set these two values in the map info string? I greatly appreciate your help and suggestions.
- Nevzat
|
|
|
|
MariM Veteran Member
Posts:2396  
19 Jan 2016 07:24 AM |
|
The reference pixel x/y is the pixel location in the image that is associated with the map coordinate in the Map Info structure. Typically this is the upper left corner of the upper left pixel, which is the [1,1] position in image coordinates. Sometimes, the pixel is referenced from the center so you might see this value as [1.5,1.5]. You could also have the center of the image be the reference pixel location or any other image coordinate. It is only important that the pixel that is referenced also has the correct map coordinate in the Map Info structure. ENVI uses this information, along with the projection string, to provide the cursor location/value of every other pixel in the image.
|
|
|
|
Deleted User New Member
Posts:  
19 Jan 2016 10:11 AM |
|
Thank you for the answer. Just to clarify:
Given the map info string: map info = {UTM, 1, 1, 145185, 2189715, 30, 30, 19, North}
Does this mean the image location given as [145185, 2189715] corresponds to pixel [1,1] in the image? In that case what is [1.5,1.5] would mean? Sometimes, I also see [0,0] or [0.5,0.5] for these values. Looks like I don't understand what is meant by the "image coordinate". Could you clarify this? Thank you very much.
- nevzat
|
|
|
|
MariM Veteran Member
Posts:2396  
19 Jan 2016 01:21 PM |
|
Does this mean the image location given as [145185, 2189715] corresponds to pixel [1,1] in the image?
Yes, it means that the location given is in reference to the upper left corner of the upper left pixel (often thought of as the 'first' pixel if reading from an array from top down). If the same location was given with a reference pixel location of [1.5, 1.5] then it means that coordinate is associated with the center of the pixel, which is sometimes the case with Geotiff files or if you convert a vector to a raster.
I should mention that the convention of using the [1,1] as referencing the upper left corner of the upper left pixel is what is done in ENVI Classic as a matter of convenience and how users often think of the 'first pixel' as being [1,1]. However, in ENVI (the new interface), we now reference image locations using zero-based arrays as you do when programming. So this means the upper left corner of the upper left pixel is now the [0,0] image coordinate. So sometimes you will see an image coordinate of [0.5, 0.5] which just means that it is referencing the center of the upper left pixel but now using a zero-based array rather than starting with 1.
Does this help?
|
|
|
|
Deleted User New Member
Posts:  
19 Jan 2016 01:31 PM |
|
I think I finally got the idea. This was very very helpful for me. I should probably use the zero-based array convention since it is the new way. Thank you very much.
|
|
|
|