×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    19

    How to Scroll/Drag Google maps

    Hi,

    I am developing a J2ME application in which I need to use google maps. At present I am using Google Static maps for mobile devices. The problem with these maps is that I am not able to drag the map using the Mobile Phone's Joystick.

    I have a requirement to drag the map using the phones joystick. Please let me know how to achieve this.


    Regards,
    Madhu.

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Smile Re: How to Scroll/Drag Google maps

    Yes,
    This article below contains useful data about google map in JAVA ME..
    Also this article contains useful link at the end of this article ..
    You can check this...
    Google map in J2ME

    best regards,
    rahulvala

  3. #3
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: How to Scroll/Drag Google maps

    Basically its hard part for making google maps based apps as google only provide static images but one can make the maps scroll but that require too much calculations nd logic like--depending on the zoom level and and pointer pressed changing the coordinates used for fetching the maps images from server
    Regards,
    Saurabh

  4. #4
    Registered User
    Join Date
    Jul 2009
    Posts
    19

    Re: How to Scroll/Drag Google maps

    Hi Rahulvala ,

    Thank you for the reply.
    Could you please let me know more about that "adjust" method in the link posted by you.I am not able to understand what that method does and also it is mentioned in the article that "adjust" method should be used to scroll the map. Please let me know how to call these methods whenever we use the phone joystick to scroll the map.



    Regards,
    Madhu.

  5. #5
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Smile Re: How to Scroll/Drag Google maps

    f you need to scroll your map, you'll need to calculate a new center for your static image. The following adjust() method will return the new map center latitude and longitude, accepting the following arguments:

    the current center latitute and longitude coordinates
    the deltaX and deltaY, in pixels, of new map center
    the map zoom level

    Look when we are scrolling image only center changes , So new center will need the new values of latitude and longitude values....

    Go to this link : Map



    best regards

  6. #6
    Registered User
    Join Date
    Jul 2009
    Posts
    19

    Re: How to Scroll/Drag Google maps

    HI,

    I am very new to J2ME and appreciate your response.

    When do you I call this method.I want to scroll the map using the phone joystick. So how do I call this method on an action of joystick?, i.e when i move the joy stick to the left the map should scroll to the left and on moving the joystick to the right i should be able to scroll the map to the right.



    Regards,
    Madhu.

  7. #7
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Smile Re: How to Scroll/Drag Google maps

    Have you used the code which is given in the article ..
    Use it ...

    Best regards..

  8. #8
    Registered User
    Join Date
    Jul 2009
    Posts
    19

    Re: How to Scroll/Drag Google maps

    Hi,

    I did use the code, but even after adding the MicroFloat library i am not able to use the MicroDouble class.
    It gives me an error that it cant recognise "MicroDouble" .

    I have added the MicroFloat library to my project.


    Regards,
    Madhu.

  9. #9
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Smile Re: How to Scroll/Drag Google maps

    To use that class or library, you first initiate it with your API key:

    Code:
    GoogleMaps gMap = new GoogleMaps("API_KEY");
    Best regards,

  10. #10
    Registered User
    Join Date
    Jul 2009
    Posts
    19

    Re: How to Scroll/Drag Google maps

    HI,

    I tried using the adjust method and I am still not able to scroll the map. My doubt is I am not calling the method anywhere , so how does the method get called? Does it get called automatically whenever I use the joystick?


    Regards,
    Madhu.

  11. #11
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Smile Re: How to Scroll/Drag Google maps

    You have to arrange the program such that the joystick controls the X-Y coordinate directions of static new image..

    return command will work and it will set the X-Y coordinates of the static image of google map...

    Best regards,,

  12. #12
    Registered User
    Join Date
    Jul 2009
    Posts
    19

    Re: How to Scroll/Drag Google maps

    Can you please let me know how to do the same.
    It would be great if you can send a sample application that just displays the image with the scrolling functionality.This would help me in understanding the concept completely.

    Thank you very much.

    Regards,
    madhu.

  13. #13
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Smile Re: How to Scroll/Drag Google maps

    Well ,
    I donot have sample application ,
    What I can do ?,,,
    I can Help you If you ask Questions related to programming ?
    Don't ask for sample application or program,,,

    Best regards,

  14. #14
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: How to Scroll/Drag Google maps

    The sample on the wiki gets one map, if the user would like to "scroll down", i.e fetch a new map that functionality has to be created... There is no API or already made service that will fetch a new map when üser presses down button"...
    That's the logic you will have to implement... Another option is to fetch a bigger map at the beginning, as in bigger than your screen's resolution, so that you will be able to actually really scroll within it's limits...
    To do that you will need to interact and respond on the user's input's... Which , in Cnavas, can be done by using the keyPressed() method... Let's say the user presses down, you catch that with the keyPressed() method, and you move the shown area downwards by 5 pixels...
    This is a technique used mostly in games, so you might want to google "scrolling background j2me" for example...
    Good luck, you will have to program a lot of logic yourself, so to have a better grasp on why code works the way it does you might as well start away right now by implementing your own

Similar Threads

  1. Google Maps Api problem
    By ingsaurabh in forum Mobile Java General
    Replies: 7
    Last Post: 2009-07-29, 16:38
  2. [Moved} Google Maps: start from contacts
    By st.b in forum General Development Questions
    Replies: 0
    Last Post: 2008-11-06, 10:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×