facebook

GoogleMapsExamplemaking call to non-existent addOverlay()

  1. MyEclipse Archived
  2.  > 
  3. Examples On-Demand
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #313713 Reply

    Eddy
    Participant

    The GoogleMapsExample is making call to non-existent function map.addOverlay(marker) in map.js . It looks like the example is using the deprecated addOverlay(). I should be using marker.setMap(map)
    See: http://code.google.com/apis/maps/documentation/javascript/overlays.html#AddingOverlays

    This example if you add Spring MVC functionality you end up with the following server side exception which results if a javascript non-existent function and the spring dojo has been loaded.

    SEVERE: Servlet.service() for servlet collector Servlet threw exception
    org.springframework.web.bind.MissingServletRequestParameterException: Required java.lang.Integer parameter ‘idKey’ is not present
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.raiseMissingParameterException(AnnotationMethodHandlerAdapter.java:545
    )
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveRequestParam(HandlerMethodInvoker.java:336)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:207)
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:132)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
    at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

    #313749 Reply

    support-joy
    Member

    eddybell,

    The GoogleMapsExample is making call to non-existent function map.addOverlay(marker) in map.js .

    Let me clarify that the map.addOverlay function is a googleMaps function. Please refer google.jsp.

    
    <script type="text/javascript"
                src="http://www.google.com/jsapi?key=ABQIAAAA7rD1jbUY1XVWsL0ov0bKehRP189eykzPrrAV7tRgT92eURxrGxQHDNt6Nc2DQaubssvpI9493dhTGg"></script>
            <script type="text/javascript">
                  google.load("maps", "2");
                  var map = null;
                  var geocoder = null;
                  google.setOnLoadCallback(function initmap() {
                      map = new google.maps.Map2(document.getElementById("map"));
                      geocoder = new google.maps.ClientGeocoder();
                  });          
            </script>
    

    This remotely loads the relevant googlemaps javascript to your clientside. To verify, I would recommend you run GoogleMaps example using sandbox/MyEclipse tomcat.

    SEVERE: Servlet.service() for servlet collector Servlet threw exception
    org.springframework.web.bind.MissingServletRequestParameterException: Required java.lang.Integer parameter ‘idKey’ is not present
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.raiseMissingParameterException(AnnotationMethodHandlerAdapter.java:545

    I would recommend you debug your application. It looks like it is missing a parameter named idKey.
    If you need help with google maps api, here is one such tutorial – http://econym.org.uk/gmap/

    #313756 Reply

    Eddy
    Participant

    Unfortunately it looks like you looked at the V2 API documentation not the V3 which is the currently Google supported API I have included some relevant links
    google search string “addoverlay google maps v3 deprecated”
    http://code.google.com/apis/maps/documentation/mapplets/overlays.html
    http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/a26ace537307c69d
    http://stackoverflow.com/questions/4187221/google-maps-javascript-problem

    #313820 Reply

    support-joy
    Member

    eddybell,

    Thank you for the links. Please note that even if addOverlay method is deprecated, it can be still used. I do not think that the issue you are referring above is a result of the addOverlay method being deprecated. Have you tried to debug your application?

    #313876 Reply

    Eddy
    Participant

    I have included dump from the firefox js debugger which shows the addOverlay as undefined. In a JS only page this is not an issue because an undefined function does nothing but if dojo has been loaded then you will get the error as above because dojo tries to lookup the addOverlay on the server side. All you need to do is run the sample and try and step into the addOverlay and you will find that it is undefined

    map:
    Object { Cn=Object, more…}

    $m
    Object { Polyline=Object, more…}

    A
    div#map

    Bg
    (0, 0) { Nd=0, more…}

    Cb
    Object { uc=”http://maps.google.com/maps/gen_204&#8243;, more…}

    Cn
    Object { nC=Object, more…}

    Dp
    null

    Fy
    undefined

    G
    Object { left=0, more…}

    Gz
    false

    Ha
    [Object { yb=0, more…}, Object { yb=0, more…}, Object { yb=0, more…}]

    Ik
    [Object { A=, more…}, Object { A=, more…}]

    JJ
    false

    Jc
    [div, div, div, 5 more…]

    Lf
    Object { g=Object, more…}

    Ma
    []

    ND
    Object { mu=Object, more…}

    Oc
    []

    Oe
    null

    PD
    Object { Pb=Object, more…}

    Qk
    []

    Rd
    30

    Sa
    0

    Sq
    false

    Up
    true

    VO
    (47.837002, -121.888858) { Nd=47.837002, more…}

    Va
    13

    WO
    13

    Yg
    Object { __e_=Object, more…}

    __e_
    Object { zoomto=, more…}

    addOverlay
    undefined

    ar
    false

    bl
    (47.837002, -121.888858) { Nd=47.837002, more…}

    ca
    [Object { Pb=Object, more…}, Object { Pb=Object, more…}, Object { Pb=Object, more…}, 12 more…]

    ce
    (322, 242) { width=322, more…}

    cu
    false

    ew
    true

    ga
    Object { A=, more…}

    hH
    Object {}

    hM
    undefined

    kE
    Object { g=Object, more…}

    l
    Object { yb=0, more…}

    mw
    false

    nh
    [Object {}, Object { g=Object, more…}]

    o
    div

    od
    null

    oh
    []

    pE
    Object { Pb=Object, more…}

    rQ
    undefined

    rc
    Object { A=, more…}

    ri
    false

    um
    div

    vc
    Object { __e_=Object, more…}

    wL
    undefined

    yv
    Object { Pb=Object, more…}

    zc
    null

    zg
    [Object { control=Object, more…}, Object { control=Object, more…}]

    zi
    true

    $
    function()

    $C
    function()

    $P
    function()

    $p
    function()

    $w
    function()

    AG
    function()

    AP
    function()

    BC
    function()

    BP
    function()

    Ce
    function()

    Dw
    function()

    Eh
    function()

    FI
    function()

    Fb
    function()

    GF
    function()

    Gd
    function()

    HR
    function()

    Hf
    function()

    I
    function()

    IJ
    function()

    J
    function()

    JA
    function()

    JG
    function()

    JL
    function()

    JP
    function()

    Jh
    function()

    Jo
    function()

    K
    function()

    KR
    function()

    Kr
    function()

    L
    function()

    LK
    function()

    LL
    function()

    LM
    function()

    LP
    function()

    Lb
    function()

    Lc
    function()

    Lk
    function()

    Ln
    function()

    Lp
    function()

    Lw
    function()

    Lx
    function()

    MF
    function()

    ML
    function()

    Me
    function()

    Mh
    function()

    Mk
    function()

    Mp
    function()

    NK
    function()

    Nc
    function()

    Nt
    function()

    Nx
    function()

    OJ
    function()

    OM
    function()

    Op
    function()

    Ow
    function()

    PJ
    function()

    PM
    function()

    Pa
    function()

    Pf
    function()

    Ps
    b(c)

    QB
    function()

    Qf
    function()

    Rc
    function()

    Rf
    function()

    Rx
    function()

    S
    function()

    SB
    function()

    Sc
    function()

    Se
    function()

    TG
    function()

    Ta
    function()

    Tg
    function()

    Tj
    function()

    UG
    function()

    Ui
    function()

    Ux
    function()

    V
    function()

    VA
    function()

    VC
    function()

    VF
    function()

    VG
    function()

    VH
    function()

    VQ
    function()

    WG
    function()

    WH
    function()

    WQ
    function()

    Ww
    function()

    X
    function()

    XQ
    function()

    Xa
    function()

    Xu
    function()

    Yt
    function()

    Yw
    function()

    Z
    function()

    Zk
    function()

    Zl
    function()

    Zw
    function()

    aB
    function()

    aK
    function()

    aP
    function()

    ad
    function()

    addControl
    function()

    addMapType
    function()

    bJ
    function()

    bq
    function()

    changeHeading
    function()

    checkResize
    function()

    cl
    function()

    clearOverlays
    function()

    closeInfoWindow
    function()

    continuousZoomEnabled
    function()

    dC
    function()

    dK
    function()

    disableContinuousZoom
    function()

    disableDoubleClickZoom
    function()

    disableDragging
    function()

    disableGoogleBar
    function()

    disableInfoWindow
    function()

    disablePinchToZoom
    function()

    disableRotation
    function()

    disableScrollWheelZoom
    function()

    dm
    function()

    doubleClickZoomEnabled
    function()

    draggingEnabled
    function()

    dy
    function()

    ea
    function()

    ec
    function()

    ej
    function()

    ek
    function()

    enableContinuousZoom
    function()

    enableDoubleClickZoom
    function()

    enableDragging
    function()

    enableGoogleBar
    function()

    enableInfoWindow
    function()

    enablePinchToZoom
    function()

    enableRotation
    function()

    enableScrollWheelZoom
    function()

    fD
    function()

    fe
    function()

    fl
    function()

    fromContainerPixelToLatLng
    function()

    fromDivPixelToLatLng
    function()

    fromLatLngToContainerPixel
    function()

    fromLatLngToDivPixel
    function()

    gD
    function()

    gc
    function()

    getBounds
    function()

    getBoundsZoomLevel
    function()

    getCenter
    function()

    getContainer
    function()

    getCurrentMapType
    function()

    getDefaultUI
    function()

    getDragObject
    function()

    getEarthInstance
    function()

    getEventContract
    function()

    getInfoWindow
    function()

    getMapTypes
    function()

    getPane
    function()

    getSize
    function()

    getZoom
    function()

    hC
    function()

    hG
    function()

    hI
    function()

    hideControls
    function()

    iI
    function()

    iK
    function()

    ic
    function()

    im
    function()

    infoWindowEnabled
    function()

    isLoaded
    function()

    isRotatable
    function()

    jI
    function()

    ja
    function()

    jb
    function()

    jj
    function()

    jm
    function()

    kD
    function()

    ks
    function()

    lJ
    function()

    lO
    function()

    la
    function()

    le
    function()

    lw
    function()

    nB
    function()

    nJ
    function()

    nM
    function()

    nN
    function()

    nb
    function()

    oK
    function()

    oo
    function()

    openInfoWindow
    function()

    openInfoWindowHtml
    function()

    openInfoWindowTabs
    function()

    openInfoWindowTabsHtml
    function()

    or
    function()

    ot
    function()

    pP
    function()

    panBy
    function()

    panDirection
    function()

    panTo
    function()

    pd
    function()

    pf
    function()

    pi
    function()

    pinchToZoomEnabled
    function()

    po
    function()

    qH
    function()

    qa
    function()

    qb
    function()

    qh
    function()

    qi
    function()

    ql
    function()

    rH
    function()

    removeControl
    function()

    removeMapType
    function()

    removeOverlay
    function()

    returnToSavedPosition
    function()

    rotationEnabled
    function()

    rq
    function()

    rw
    function()

    savePosition
    function()

    scrollWheelZoomEnabled
    function()

    setCenter
    function()

    setFocus
    function()

    setMapType
    function()

    setUI
    function()

    setUIToDefault
    function()

    setZoom
    function()

    showControls
    function()

    showMapBlowup
    function()

    tb
    function()

    uk
    function()

    updateCurrentTab
    function()

    updateInfoWindow
    function()

    us
    function()

    uu
    function()

    vG
    function()

    vL
    function()

    wD
    function()

    wa
    function()

    wf
    function()

    wg
    function()

    wq
    function()

    wx
    function()

    xC
    function()

    xL
    function()

    xf
    function()

    yr
    function()

    ys
    function()

    zE
    function()

    zo
    function()

    zoomIn
    function()

    zoomOut
    function()

    #313890 Reply

    Brian Fernandes
    Moderator

    Eddy,

    I have not tried this example in some time, but I did today and it worked fine.

    If I comment out the map.addOverlay method in map.js, then when I look up an address, the map shifts to the position that I keyed in, but no marker is added at that point.

    If I put the line back in, the marker appears.

    I did not attempt to debug the code, but empirically, the addOverlay method seems to be alive and working as originally intended. Have you tried it in an unmodified project, before adding Spring MVC etc?

    Nevertheless, since the method is deprecated, we will use the newer method when overhauling the example code, I have filed a bug for this, thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: GoogleMapsExamplemaking call to non-existent addOverlay()

You must be logged in to post in the forum log in