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

Home » Public Forums » archive » Error with MapProjection::Forward
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Error with MapProjection::Forward [message #86665 is a reply to message #86663] Wed, 27 November 2013 05:56 Go to previous messageGo to previous message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
I tried this but still it doesn't work. My corrected code is as below:
; -------------------------------
PRO MELPITZ_GOOGLE_PLOT

CLOSE,/ALL

; DOWNLOAD A MAP
url = "http://maps.googleapis.com/maps/api/staticmap?" + $
"center=51.525517,12.927633&zoom=14&size=600x600" + $
"&maptype=satellite&sensor=true"

netObject = IDLnetURL()
!null = netObject.Get(URL=url, FILENAME="melpitz.png")
netObject = 0

; Load the newly created file
READ_PNG, "melpitz.png", img

; DISPLAY THE MAP IMAGE WITH THE MAP PROJECTION

centerLon = 12.927633D
centerLat = 51.525517D
zoom = 14
Re = 6378137D ; Radius of the Earth
resolution = (2*!DPI*Re)/(256*2D^zoom) ; meters/pixel
PRINT, resolution

; The image is 600 pixel wide by 600 pixel tall
deltax = 600*resolution ; meters
deltay = 600*resolution ; meters

; Convert the map center to spherical Mercator coordinates
; Create a hidden map object to do the conversions.
; Setup map projection, draw a grid
m = MAP('Mercator',/BUFFER, $
SEMIMAJOR_AXIS=6378137D, SEMIMINOR_AXIS=6378137D, $
CENTER_LONGITUDE=centerLon,LIMIT=[51.515D,12.91D,51.540D,12. 95D])
print,m
; Convert from longitude/latitude to meters
uv = m.MapForward(centerLon, centerLat)

; Compute the image bounding box in spherical Mercator coordinates
x0 = uv[0] - deltax/2 ; meters
x1 = uv[0] + deltax/2 ; meters
y0 = uv[1] - deltay/2 ; meters
y1 = uv[1] + deltay/2 ; meters
m.Close

PRINT, [x0, y0, x1, y1]

END
;-----------------------------

I get the same error message ...
% Attempt to call undefined method: 'MAPPROJECTION::MAPFORWARD'.
% Execution halted at: MELPITZ_GOOGLE_PLOT 38

I don't have any clue now!!! Any help to solve this issue will be of great help.

Regards


On Wednesday, November 27, 2013 2:23:47 PM UTC+1, David Fanning wrote:
> Madhavan Bomidi writes:
>
>
>
>> I tried to search in Google for the possible solution to the problem but could not resolve. Am I missing some function files? Please suggest me to resolve this issue and go forward.
>
>
>
> This appears to be a typo. Try this, instead:
>
>
>
> uv = m.mapForward(centerLon, centerLat)
>
>
>
> 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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rounding errors and the New Graphics image routine
Next Topic: ENVI_OPEN_FILE not found

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

Current Time: Wed Oct 08 13:39:12 PDT 2025

Total time taken to generate the page: 0.00417 seconds