Projected Meter Space and mapCoord [message #88967] |
Wed, 09 July 2014 06:48  |
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   |
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 #88970 is a reply to message #88968] |
Wed, 09 July 2014 07:30   |
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  |
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.")
|
|
|