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 
Return to the default flat view 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 previous 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...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
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:14:56 PDT 2025

Total time taken to generate the page: 0.00432 seconds