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

Home » Public Forums » archive » Projected Meter Space and mapCoord
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
Projected Meter Space and mapCoord [message #88967] Wed, 09 July 2014 06:48 Go to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
Hello,

I'm looking more just for clarification so that I can understand further. I understand that latitude and longitude points have to be converted into projected meter space to be correctly placed on a map background. I've run my code 2 different ways, first using

city_lats = [ 39.75, 41.29, 33.84, 45.49, 47.62, 40.22]
city_lons = [ -105.00, -95.92, -84.38, -122.69, -122.34, -74.78]
xy = mapCoord->Forward(city_lons, city_lats)
city_x = Reform(xy[0,*])
city_y = Reform(xy[1,*])
cgPlotS, city_x[j], city_y[j], Color=Byte(j+1), PSYM=16, SYMSize=2.0


and the second just using
city_lats = [ 39.75, 41.29, 33.84, 45.49, 47.62, 40.22]
city_lons = [ -105.00, -95.92, -84.38, -122.69, -122.34, -74.78]
cgPlotS, city_lons(j), city_lats(j), map=mapCoord, Color=Byte(j+1), PSYM=16, SYMSize=2.0

mapCoord has already been defined in both cases. I just abbreviated the code for simplicity. It appears that both graph exactly the same and look correct. I'm wondering if this is true and if it matters what method you use or if one is better, mapCoord->Forward(lon,lat) or cgPlotS, map=mapCoord. I would like to do things correctly and not incorrect but still have them seem to work for some reason.

Thanks.
-Morgan
Re: Projected Meter Space and mapCoord [message #88968 is a reply to message #88967] Wed, 09 July 2014 07:00 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> I'm looking more just for clarification so that I can understand further. I understand that latitude and longitude points have to be converted into projected meter space to be correctly placed on a map background. I've run my code 2 different ways, first using
>
> city_lats = [ 39.75, 41.29, 33.84, 45.49, 47.62, 40.22]
> city_lons = [ -105.00, -95.92, -84.38, -122.69, -122.34, -74.78]
> xy = mapCoord->Forward(city_lons, city_lats)
> city_x = Reform(xy[0,*])
> city_y = Reform(xy[1,*])
> cgPlotS, city_x[j], city_y[j], Color=Byte(j+1), PSYM=16, SYMSize=2.0
>
>
> and the second just using
> city_lats = [ 39.75, 41.29, 33.84, 45.49, 47.62, 40.22]
> city_lons = [ -105.00, -95.92, -84.38, -122.69, -122.34, -74.78]
> cgPlotS, city_lons(j), city_lats(j), map=mapCoord, Color=Byte(j+1), PSYM=16, SYMSize=2.0
>
> mapCoord has already been defined in both cases. I just abbreviated the code for simplicity. It appears that both graph exactly the same and look correct. I'm wondering if this is true and if it matters what method you use or if one is better, mapCoord->Forward(lon,lat) or cgPlotS, map=mapCoord. I would like to do things correctly and not incorrect but still have them seem to work for some reason.

The two methods are identical. When you pass mapCoord to cgPlotS in the
second method, it simply allows you to perform the caculations you do by
hand in the first method.

My point was that if you have NaNs in the latitude and logitude vectors
that you are trying to display, neither of these two methods can be
completed successfully. It sounded to me as if that was the problem you
are experiencing.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Projected Meter Space and mapCoord [message #88969 is a reply to message #88967] Wed, 09 July 2014 07:01 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
Well, if you dig around in cgPlotS, you'll find out what happens if you pass the mapCoord object. Look around line 244 or so.

Basically, if you provide mapCoord, it calls the Forward method for you.

I would prefer the latter - fewer lines of code to do the same thing :-)
Re: Projected Meter Space and mapCoord [message #88970 is a reply to message #88968] Wed, 09 July 2014 07:30 Go to previous messageGo to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Wednesday, July 9, 2014 10:00:34 AM UTC-4, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> I'm looking more just for clarification so that I can understand further. I understand that latitude and longitude points have to be converted into projected meter space to be correctly placed on a map background. I've run my code 2 different ways, first using
>
>>
>
>> city_lats = [ 39.75, 41.29, 33.84, 45.49, 47.62, 40.22]
>
>> city_lons = [ -105.00, -95.92, -84.38, -122.69, -122.34, -74.78]
>
>> xy = mapCoord->Forward(city_lons, city_lats)
>
>> city_x = Reform(xy[0,*])
>
>> city_y = Reform(xy[1,*])
>
>> cgPlotS, city_x[j], city_y[j], Color=Byte(j+1), PSYM=16, SYMSize=2.0
>
>>
>
>>
>
>> and the second just using
>
>> city_lats = [ 39.75, 41.29, 33.84, 45.49, 47.62, 40.22]
>
>> city_lons = [ -105.00, -95.92, -84.38, -122.69, -122.34, -74.78]
>
>> cgPlotS, city_lons(j), city_lats(j), map=mapCoord, Color=Byte(j+1), PSYM=16, SYMSize=2.0
>
>>
>
>> mapCoord has already been defined in both cases. I just abbreviated the code for simplicity. It appears that both graph exactly the same and look correct. I'm wondering if this is true and if it matters what method you use or if one is better, mapCoord->Forward(lon,lat) or cgPlotS, map=mapCoord. I would like to do things correctly and not incorrect but still have them seem to work for some reason.
>
>
>
> The two methods are identical. When you pass mapCoord to cgPlotS in the
>
> second method, it simply allows you to perform the caculations you do by
>
> hand in the first method.
>
>
>
> My point was that if you have NaNs in the latitude and logitude vectors
>
> that you are trying to display, neither of these two methods can be
>
> completed successfully. It sounded to me as if that was the problem you
>
> are experiencing.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Yes, that was the problem and I understood you're response. Duh, of course NaN's can't be projected onto metered space in a map. I should have realized that. I guess I just assumed they would be skipped over. The whole metered space issue still had me thinking about these two methods though, hence the new question for clarification.
Re: Projected Meter Space and mapCoord [message #88971 is a reply to message #88970] Wed, 09 July 2014 07:38 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> Yes, that was the problem and I understood you're response. Duh, of course NaN's can't be projected onto metered space in a map. I should have realized that. I guess I just assumed they would be skipped over. The whole metered space issue still had me thinking about these two methods though, hence the new question for clarification.

The reason for preferring to work in projected meter space is that the
grid (like an image pixel) is rectangular. Very simple to match the grid
with a projected image. Lat/Lon grids are, uh, NOT rectangular. Working
in that space is a nightmare. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: cgPlotS problem with NaN values in data
Next Topic: Reading Multiple .sav files with same variable names for graphing

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

Current Time: Wed Oct 08 15:10:42 PDT 2025

Total time taken to generate the page: 0.01030 seconds