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

Home » Public Forums » archive » Re: Map to data coordinate conversion
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Map to data coordinate conversion [message #83923] Thu, 18 April 2013 08:27 Go to previous message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Thursday, April 18, 2013 11:12:16 AM UTC-4, Chris Torrence wrote:
> On Thursday, April 18, 2013 8:19:48 AM UTC-6, Paul Mallas wrote:
>
>> Hello all,
>
>>
>
>>
>
>>
>
>> I am looking to convert, given a geotff image with map info, the lat/lon data to a pixel location in an image.
>
>>
>
>>
>
>>
>
>> What I want to do seems pretty easy, but I am having a hard time coding it in IDL for some reason. I must be missing something.
>
>>
>
>>
>
>>
>
>> Using the ENVI() API, this was straight forward:
>
>>
>
>>
>
>>
>
>> oEnvi = envi(/headless)
>
>>
>
>> eMask = oEnvi->openRaster(file)
>
>>
>
>> fid = ENVIRasterToFID(eMask)
>
>>
>
>> envi_convert_file_coordinates, fid, xf, yf, lon, lat
>
>>
>
>>
>
>>
>
>> with lon, lat being my predefined input and xf, yf being my desired output.
>
>>
>
>>
>
>>
>
>> The analogous way to do this in IDL is (I think):
>
>>
>
>>
>
>>
>
>> img = image(file, /buffer)
>
>>
>
>> xy = img->convertcoord(lon, lat, /to_data)
>
>>
>
>>
>
>>
>
>> however the image() function won't read the geotiff properly (but ENVI() accepts it just fine). Perhaps my geotiff tag is not properly formed or something. Ideas on another way?
>
>
>
> Hi Paul,
>
>
>
> I think you want to use the MapForward method. Something like this:
>
>
>
> i = image(FILEPATH('boulder.tif',SUBDIR=['examples','data']))
>
> print, i.mapforward(-105,40)
>
>
>
> The ConvertCoord is just for converting between screen/normalized/data coordinates, and not between lat/lon and data.
>
>
>
> Hope this helps.
>
> -Chris
>
> ExelisVIS

Great - that's what I am thinking of.

I am encountering a problem with image() though - my geotiff won't load with correctly. I get this error:
IMAGE: Unable to invoke method on NULL object reference: <OBJREF (<NullObject>)>.

This same image works just fine with the ENVI API - perhaps there is some deficiency in my geotiff values.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: I need to bulid a digital phantom urgently, Thanks for help!
Next Topic: How to use IDL routines to estimate entropy

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

Current Time: Thu Oct 09 23:50:35 PDT 2025

Total time taken to generate the page: 0.64147 seconds