I have 2 parts to my question. First part: I followed THIS SO question and am able to display a static google map. But I have a list of lat/long values which I want to display, on the same map, using markers for each of the coordinates. The code using JFrame is below (I added a second set of parameters, just to test). I am able to display only one coordinate and not the second one.
JFrame frame = new JFrame("Google maps");
String destinationFile = "image.jpg";
try {
String imageUrl = "http://maps.googleapis.com/maps/api/staticmap?zoom=18&size=800x800&markers=45.10232295,-80.14865993&sensor=true";
URL url = new URL(imageUrl);
frame.add( new JLabel( new ImageIcon( new ImageIcon(url).getImage().getScaledInstance( 630, 600, java.awt.Image.SCALE_SMOOTH ) ) ) );
/* Second set to test if same map can display multiple markers */
String imageUrl2 = "http://maps.googleapis.com/maps/api/staticmap?zoom=18&size=800x800&markers=44.10253392,-81.14871575&sensor=true";
URL url2 = new URL(imageUrl2);
frame.add( new JLabel( new ImageIcon( new ImageIcon(url2).getImage().getScaledInstance( 630, 600, java.awt.Image.SCALE_SMOOTH ) ) ) );
frame.setVisible(true);
frame.pack();
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
Second part: Google has THIS tutorial to display maps.
My question: I need to parse a text file in order to get the GPS coordinates. Text parsing is easy in Java. Considering that text parsing has to be done apart from displaying the map, which of the 2 parts mentioned above is a better way to display maps? I am a newbie in this, hence the question.
Thanks.