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

Home » Public Forums » archive » Re: image interplate and overlay lat/lon?
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
Re: image interplate and overlay lat/lon? [message #81175] Wed, 22 August 2012 10:13 Go to next message
beardown911 is currently offline  beardown911
Messages: 21
Registered: March 2007
Junior Member
On Wednesday, August 22, 2012 10:57:48 AM UTC-5, go cats wrote:
> Hello all,
>
>
>
> My goal is to take an image(s) and overlay geographic lat/lon information onto the image. I have lat/lon information of four boundaries and tried to create a regular grid using them.
>
>
>
> I’ve used David’s code to generate a regular lat/lon grid, and tried to interpolate image with gridded lat/lon data.
>
>
>
> However, outImage looks blank and only geographin lat/lon data are shown with 0 image pixel values. I am working on 8-bit tif images.
>
>
>
> Would anybody give me some tips how to make this work or what I did wrong?
>
>
>
> Thanks in advance,
>
> Kim
>
>
>
> P.S. Below is what I've been working on.
>
> ;---------------------------------------------------------
>
> ; image(0,0)locates at the upper left corner
>
> xOrigin = maxLon
>
> yOrigin = maxLat
>
>
>
> xscale = (maxLon – minLon)/nS
>
> yscale = (maxLat – minLat)/nL
>
>
>
> uvec = Findgen(nS) * xscale + xOrigin
>
> vvec = yOrigin - (Findgen(nL) * yscale)
>
>
>
> uarray = Rebin(uvec, nS, nL)
>
> varray = Rebin(Reform(vvec, 1, nL), nS, nL)
>
>
>
> outImage = Interpolate(inImage, varray, uarray)
>
> .
>
> .
>
> .
>
> geoTag = { $
>
> ModelTiepointTag: [0.0, 0.0, 0.0, xOrigin, yOrigin, 0.0], $
>
> ModelPixelScaleTag: [xscale, yscale, 0.0], $
>
> GTModelTypeGeoKey: 2, $ ; (ModelType Geographic)
>
> GTRasterTypeGeoKey: 2, $ ; (RasterPixelIsPoint)
>
> GeographicTypeGeoKey: 4326 $ ; (WGS84)
>
> }
>
> .
>
> .
>
> WRITE_TIFF, outImage, GEOTIFF = geoTag
>
> ;-----------------------------------------------------

Thanks David for your prompt answer and guide.
Yes, as you pointed, no interpolate is needed for the input image.
Image array and lat/lon grids have the same size.

I'll read through "Map Structures" and try it.

Thank you again and have a nice day!

Kim
Re: image interplate and overlay lat/lon? [message #81176 is a reply to message #81175] Wed, 22 August 2012 09:49 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
go cats writes:

> My goal is to take an image(s) and overlay geographic lat/lon information onto the image. I have lat/lon information of four boundaries and tried to create a regular grid using them.
>
> I?ve used David?s code to generate a regular lat/lon grid, and tried to interpolate image with gridded lat/lon data.
>
> However, outImage looks blank and only geographin lat/lon data are shown with 0 image pixel values. I am working on 8-bit tif images.
>
> Would anybody give me some tips how to make this work or what I did wrong?

After doing a bit of research, I guess this is the right way
to create a GeoTiff grid with an equal-area cylindrical (called
other names!) projection. Although, I really don't know what
"Raster Pixel is Point" means. It seems to me a raster pixel
describes an area.

Anyway, I don't see any reason for Interpolating the input
image. Presumably your grid *describes* the input image.
If you really want to make it another size, I would use
Congrid. That has the advantage of doing the interpolation
correctly and in a way I don't have to worry about it. :-)

As far as not seeing anything, is this because you haven't
scaled the data, or because you tried to interpolate byte
data, or ... God only knows what.

I would *guess* your image might be upside down. When I
work with images and GeoTiff files, I always reverse the
Y direction when I read from the Tiff file, and reverse
it again when I write it.

Write_Tiff, Reverse(outimage,2), GEOTIFF=geoTag

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: image interplate and overlay lat/lon? [message #81177 is a reply to message #81176] Wed, 22 August 2012 09:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
go cats writes:

> My goal is to take an image(s) and overlay geographic lat/lon information onto the image. I have lat/lon information of four boundaries and tried to create a regular grid using them.
>
> I?ve used David?s code to generate a regular lat/lon grid, and tried to interpolate image with gridded lat/lon data.
>
> However, outImage looks blank and only geographin lat/lon data are shown with 0 image pixel values. I am working on 8-bit tif images.
>
> Would anybody give me some tips how to make this work or what I did wrong?

Maybe there are GeoTiff files that use latitude and longitude values for
the tie points and scales, but I've never seen any. All the GeoTiff
files I've ever worked with use projected meter values and include
information about the map projection in the file.

You shouldn't have to do any image interpolation. Basically,
what you want to do it just fit a projected map grid around
the image itself.

http://www.idlcoyote.com/map_tips/ephemeral.php

Then, you put the parameters of the grid into the appropriate
spots in your geoTiff structure and you are good to go.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: image interplate and overlay lat/lon? [message #81250 is a reply to message #81177] Mon, 27 August 2012 03:49 Go to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Wednesday, 22 August 2012 18:26:11 UTC+2, David Fanning wrote:
> go cats writes:

> Maybe there are GeoTiff files that use latitude and longitude values for
> the tie points and scales, but I've never seen any. All the GeoTiff
> files I've ever worked with use projected meter values and include
> information about the map projection in the file.

<OffTopic>
The near-global digital elevation model data from the NASA Shuttle Radar Topography Mission, see http://srtm.csi.cgiar.org/, is distributed on a latitude/longitude grid, as GeoTIFF. Due to its "near-globalness", obviously.
</OffTopic>

--
Yngvar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: For loop avoidance - getting indices of real space
Next Topic: A simple DLM question

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

Current Time: Wed Oct 08 19:30:52 PDT 2025

Total time taken to generate the page: 0.00504 seconds