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

Home » Public Forums » archive » Re: map_proj_inverse question
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: map_proj_inverse question [message #74383] Wed, 12 January 2011 11:10
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
nata writes:

> Thank you David, I can get the lat/lon values of the mouse position
> doing:
>
> result=CONVERT_COORD(event.X,event.Y,/DEVICE,/TO_DATA)
>
> The problem I have is that my map coordinate system is not set up. So
> when I call CONVERT_COORD I obtain the following message :
> % CONVERT_COORD: Window is closed and unavailable.

Yes, this is one reason I created the MapCoord object
in the Catalyst Library. I was doing a lot of map
projections in widget programs and I needed to be able
to make sure the map data coordinate system was "alive"
when I needed it. Simply calling the Draw method on the
MapCoord object restores the data coordinate system without
actually drawing anything.

WSet, info.mapWindow
info.mapCoord -> Draw

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: map_proj_inverse question [message #74384 is a reply to message #74383] Wed, 12 January 2011 11:00 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Sorry guys,

There is a mistake on my formula :

X=event.X/dim[0]*uv_box_lenght[0] + !map.UV_BOX[0]
Y=event.Y/dim[1]*uv_box_lenght[1] + !map.UV_BOX[1]

Now, this is correct ! :P

nata
Re: map_proj_inverse question [message #74385 is a reply to message #74384] Wed, 12 January 2011 10:53 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Thank you David, I can get the lat/lon values of the mouse position
doing:

result=CONVERT_COORD(event.X,event.Y,/DEVICE,/TO_DATA)

The problem I have is that my map coordinate system is not set up. So
when I call CONVERT_COORD I obtain the following message :
% CONVERT_COORD: Window is closed and unavailable.

I'm creating my images in a Z-buffer and when I restore the X device I
lose the map coordinate system. However, I have a copy of the !map
structure.

Is there a way to retrieve the lat/lon without using CONVERT_COORD ?

Thank you,
nata
Re: map_proj_inverse question [message #74386 is a reply to message #74385] Wed, 12 January 2011 10:15 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
nata writes:

> I'm setting a projection using MAP_SET (IDL 7.1), after that I want to
> retrieve the lat/lon values of the mouse position.
> What I'm doing is the following :
>
> 1) I retrieve the mouse position, using event.X and event.Y
> 2) After that, I normalize the X,Y position, taking in account the
> UV_BOX of the map structure
>
> uv_box_lenght=[!map.UV_BOX[2]-!map.UV_BOX[0],!map.UV_BOX[3]- !
> map.UV_BOX[1]]
>
> X=event.X/dim[0]*uv_box_lenght[0] + uv_box_lenght[0]
> Y=event.Y/dim[1]*uv_box_lenght[1] + uv_box_lenght[1]
>
> 3) And I calculate the lat/lon values using map_proj_inverse
>
> PRINT, MAP_PROJ_INVERSE(X,Y,MAP_STRUCTURE=!map)
>
> Mmmmh !!!! Something is not working well because the values I obtain
> are incorrect.
> What am I missing ?

If you have a map coordinate system set up, just
use Convert_Coord to convert your device coordinates
to data coordinates. If these are in projected meters
(I hope so!), then just use Map_Proj_Inverse to convert
these to lat/lon.

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Extracting cluster indices from a dendrogram
Next Topic: Re: FFT of gaussian

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

Current Time: Fri Oct 10 11:37:43 PDT 2025

Total time taken to generate the page: 0.39994 seconds