Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Unhappy google maps static api on java se

    I need some help in using google maps static api.
    it involves connecting to a url link, and the link then sends the map as an image to the application.

    i am having trouble in connecting with the GET service to fetch the image.
    also the image fetched will be a byte array, then how to convert in into an image to be displayed .?

    there is a program for the job in J2ME, but i need it as a desktop application.
    Google Maps API in Java ME - Forum Nokia Wiki is the link to the program in J2ME.

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default

    note:
    "use of static maps outside of the browser is not allowed. (Google Maps API Premier users are waived of this requirement.)" --> Google Static Maps API - Google Code

    You could use the ImageIO class:

    Java Code:
    	public static void main(String[] args) throws Exception{
    		JFrame frame = new JFrame();
    		JPanel panel = new JPanel();
    		BufferedImage image = ImageIO.read(new URL("http://maps.google.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&sensor=false"));
    		JLabel label = new JLabel(new ImageIcon(image));
    		panel.add(label);
    		frame.add(panel);
    		frame.pack();
    		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		frame.setLocationRelativeTo(null);
    		frame.setVisible(true);
    	}

  3. #3
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

Similar Threads

  1. Replies: 1
    Last Post: 11-14-2010, 08:44 AM
  2. Replies: 0
    Last Post: 07-12-2010, 11:57 AM
  3. how to use google finance api java
    By theseven in forum New To Java
    Replies: 1
    Last Post: 02-13-2010, 02:45 PM
  4. Java application using google calendar
    By nikolas8 in forum Java Applets
    Replies: 3
    Last Post: 03-20-2009, 12:49 AM
  5. Google Maps API
    By mew in forum New To Java
    Replies: 0
    Last Post: 12-26-2007, 10:28 AM

Tags for this Thread

Posting Permissions

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