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

Home » Public Forums » archive » rong coordinates with write tiff
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
rong coordinates with write tiff [message #93175] Fri, 06 May 2016 21:25 Go to next message
omar ali is currently offline  omar ali
Messages: 13
Registered: December 2015
Junior Member
Hi,
I have subset a tiff image and use write_tiff, file, output, GEOTIFF = GEO, /float. the coordinates of the subset is wrong. the upper left corner coordinates of the subset is the same of the original image although the subset is located at the middle of the image. Anyone faced such a problem !!!!


Thanks,

Omar
Re: rong coordinates with write tiff [message #93192 is a reply to message #93175] Tue, 10 May 2016 20:32 Go to previous message
jiashenyue is currently offline  jiashenyue
Messages: 10
Registered: January 2013
Junior Member
On Friday, May 6, 2016 at 9:25:43 PM UTC-7, omar ali wrote:
> Hi,
> I have subset a tiff image and use write_tiff, file, output, GEOTIFF = GEO, /float. the coordinates of the subset is wrong. the upper left corner coordinates of the subset is the same of the original image although the subset is located at the middle of the image. Anyone faced such a problem !!!!
>
>
> Thanks,
>
> Omar

If you just "subset" your tiff by obtaining a new matrix through specifying the start and end col/row, this WON'T change anything you have in the geo_tiff structure. If you keep using the original geo_tiff structure for your output, it will still create exactly the same spatial extent as it used to be. So if you want to get the correct extent, you have to manually calculate the upper (upper left, UL) and lower (lower right, LR) bounds of the new subset.

First obtain the upper left and lower right corner coordinates, then check the cell size of your original data. With the above information, it is very easy to calculate the upper left and lower right coordinates of your subset.

For example, you have a matrix named ARR, and the origin of your coordinate system is to the northwest of your upper left corner. In other words, the X (column) of the original UL is smaller than the X of the original LR, the Y (row) of the original UR is smaller than the Y of the original LR. It is extremely important to compare the original UL and LR coordinates, since if this step is missing, you won't know if you move your upper left corner, your new UL will have a smaller or large X (or Y).

Suppose the coordinate of UL corner is (-123456,5678) (unit = meters if you are using a standard projected coordinate system) and your cell size is 30 m, and your new subset start from the 2nd row and 2nd column of the original data (start from ARR[1,1]). Your new UL coordinates are:

(-123445+30*1,5678-30*1)

Do this for lower right corner as well, be careful about whether to add or subtract distance from the original coordinates.

After getting the new bounds, assign the new bounds to the geo_tiff structure and use the new structure for output.

Hope it helps!

Shenyue
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: What's the meaning of negative fluxes in source photometry?
Next Topic: CPU Process Manager Library / Parallel Processing

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

Current Time: Wed Oct 08 07:15:23 PDT 2025

Total time taken to generate the page: 0.00380 seconds