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

Home » Public Forums » archive » How to control the lat-lon axis when using Google Static map as background?
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
How to control the lat-lon axis when using Google Static map as background? [message #88318] Mon, 14 April 2014 02:55 Go to next message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello,

I am trying to overlay some points on a google static map as background. I find a problem with the y-axis labels. I see 51.52, 51.52, 51.53, 51.54, 51.54 (repetitive values!!!) while for x-axis they are 12.91,12.92,12.93,12.94,12.95

Why I am getting these repetitive labels on the y-axis? Is there a way to control these axis labels? Can I provide the values I want to see on the labels?

Also, can anyone help me in putting a bar which indicates km scale along x-axis and y-axis?

Below is the code I am using:

----------------------------
PRO test_GooglePlot

CLOSE,/ALL

Lats=[51.51D,51.55D] ; deg.N
Lons=[12.91D,12.95D] ; deg E
centerLat=(MAX(Lats) + MIN(Lats)) / 2.0 ; deg. N
centerLon=(MAX(Lons) + MIN(Lons)) / 2.0 ; deg. E

zoom=14
scale=cgGoogle_MetersPerPixel(zoom)
xsize= 600 < 640 ; Max size of Google image with this Google API
ysize= 600 < 640 ; Max size of Google image with this Google API
resolution = STRTRIM(xsize,2) + 'x' + STRTRIM(ysize,2)

googleImageFilename='testgoogleimg.png'

googleStr="http://maps.googleapis.com/maps/api/staticmap?" + $
"center=" + StrTrim(centerLat,2) + ',' + StrTrim(centerLon,2) + $
"&zoom=" + StrTrim(zoom,2) + "&size=" + resolution + $
" &scale=2&maptype=satellite&sensor=true&forma t=png32 "

netObject = Obj_New('IDLnetURL')
void = netObject -> Get(URL=googleStr, FILENAME=googleImageFilename)
Obj_Destroy, netObject
googleImage = Read_Image(googleImageFilename)

mapCoord = Obj_New('cgMap', 'Mercator', ELLIPSOID='WGS 84') ; ,/OnImage
uv = mapCoord -> Forward(centerLon, centerLat)
uv_xcenter = uv[0,0]
uv_ycenter = uv[1,0]
xrange = [uv_xcenter - (xsize/2.0D*scale), uv_xcenter + (xsize/2.0D*scale)]
yrange = [uv_ycenter - (ysize/2.0D*scale), uv_ycenter + (ysize/2.0D*scale)]
mapCoord -> SetProperty, XRANGE=xrange, YRANGE=yrange
PRINT, xrange, yrange

geo_lat=[51.5256, 51.5290, 51.5296, 51.5261, 51.5269, 51.5250, 51.5256, $
51.5260, 51.5300, 51.5264, 51.5255, 51.5252, 51.5271, 51.5257, $
51.5253, 51.5249, 51.5201, 51.5220, 51.5256, 51.5260, 51.5251, $
51.5265, 51.5257, 51.5186, 51.5227, 51.5257, 51.5198, 51.5361, $
51.5263, 51.5200, 51.5350, 51.5312, 51.5187, 51.5260, 51.5260, $
51.5247, 51.5257, 51.5217, 51.5266, 51.5264, 51.5255, 51.5265, $
51.5260, 51.5252, 51.5287, 51.5277, 51.5227, 51.5251, 51.5341, $
51.5248]

geo_lon=[12.9289, 12.9264, 12.9259, 12.9223, 12.9135, 12.9254, 12.9277, $
12.9272, 12.9280, 12.9264, 12.9257, 12.9262, 12.9421, 12.9272, $
12.9272, 12.9272, 12.9410, 12.9229, 12.9254, 12.9288, 12.9373, $
12.9279, 12.9267, 12.9291, 12.9307, 12.9179, 12.9373, 12.9405, $
12.9313, 12.9202, 12.9277, 12.9350, 12.9134, 12.9264, 12.9256, $
12.9254, 12.9262, 12.9274, 12.9285, 12.9256, 12.9281, 12.9272, $
12.9280, 12.9290, 12.9200, 12.9319, 12.9273, 12.9282, 12.9167, $
12.9263]

cgPlotS, geo_lon, geo_lat, PSYM=16, SYMSIZE=2.0, MAP=mapCoord, $
THICK=2.5, COLOR='yellow'

END

test_GooglePlot

cgPS_Open,'test_googleplot.ps'
test_GooglePlot
cgPS_Close

cgPS2Raster,'test_googleplot.ps',/PNG,/Portrait, $
Width=600, DENSITY=300, RESIZE=100

END

-----------------------------


Thanks in advance...
Re: How to control the lat-lon axis when using Google Static map as background? [message #88321 is a reply to message #88318] Mon, 14 April 2014 05:40 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Madhavan Bomidi writes:

> I am trying to overlay some points on a google static map as background. I find a problem with the y-axis labels. I see 51.52, 51.52, 51.53, 51.54, 51.54 (repetitive values!!!) while for x-axis they are 12.91,12.92,12.93,12.94,12.95
>
> Why I am getting these repetitive labels on the y-axis? Is there a way to control these axis labels? Can I provide the values I want to see on the labels?
>
> Also, can anyone help me in putting a bar which indicates km scale along x-axis and y-axis?

Well, don't know. If you see labels on your plot, you have better eyes
than I do. When I run your code, I see some yellow dots on a white
background. The description of your problem, however, leads me to
conclude that you need to change the format of your label output from
f0.2 to f0.3.

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: How to control the lat-lon axis when using Google Static map as background? [message #88327 is a reply to message #88321] Tue, 15 April 2014 01:17 Go to previous messageGo to next message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello David,

Thanks for your response. How can change the format of the label while using cgPlotS function?

Sorry for inconvenience,
Thanks again,
Madhavan


On Monday, April 14, 2014 2:40:32 PM UTC+2, David Fanning wrote:
> Madhavan Bomidi writes:
>
>
>
>> I am trying to overlay some points on a google static map as background. I find a problem with the y-axis labels. I see 51.52, 51.52, 51.53, 51.54, 51.54 (repetitive values!!!) while for x-axis they are 12.91,12.92,12.93,12.94,12.95
>
>>
>
>> Why I am getting these repetitive labels on the y-axis? Is there a way to control these axis labels? Can I provide the values I want to see on the labels?
>
>>
>
>> Also, can anyone help me in putting a bar which indicates km scale along x-axis and y-axis?
>
>
>
> Well, don't know. If you see labels on your plot, you have better eyes
>
> than I do. When I run your code, I see some yellow dots on a white
>
> background. The description of your problem, however, leads me to
>
> conclude that you need to change the format of your label output from
>
> f0.2 to f0.3.
>
>
>
> 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: How to control the lat-lon axis when using Google Static map as background? [message #88328 is a reply to message #88327] Tue, 15 April 2014 06:04 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Madhavan Bomidi writes:

> Thanks for your response. How can change the format of the label while using cgPlotS function?

Humm. Not sure I understand your question. With cgPlotS, one controls
the "format" of the symbol by choosing one of the 50 or so symbols
allowed, changing its size (SymSize) and color (SymColor) as needed.

But, I thought you were talking about numbers. If you are asking how do
you format numbers that you put onto a plot with a command like cgText,
then I would say it is done with the String function:

number = 123.4567
numberAsLabel = String(number, Format='(F0.2)')
cgText, lon, lat, numberAsLabel, Size=2.0

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: How to control the lat-lon axis when using Google Static map as background? [message #88347 is a reply to message #88328] Wed, 16 April 2014 03:17 Go to previous message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello Dave,

I wanted to control the x- and y- label format. I solved my problem.

Thanks ...
Madhavan
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help converting MATLAB to IDL
Next Topic: Multiplying very high with very low numbers: erfc * exp

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

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

Total time taken to generate the page: 0.00810 seconds