Google Static Maps API について

Java からの取得方法

普通に URLConnection で、HTTP GET するだけ

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
       try {
            // TODO add your handling code here:

            URL url = new URL(
                    "http://maps.google.com/maps/api/staticmap?center="
                    + jTextField1.getText() + "," + jTextField2.getText()
                    + "&zoom=" + jTextField3.getText() + "&size=512x512&sensor=false");
            URLConnection con = url.openConnection();
            InputStream in = con.getInputStream();
            Image img = ImageIO.read(in);
            in.close();
            
            jPanel1.getGraphics().drawImage(img, 0,0, null);
            
        } catch (Exception ex) {
            Logger.getLogger(MapFrame.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }

適当に NetBeans? で Swing アプリを作ってみた。おーすばらしい
map1.png map2.png

画像の左端・右端の経度は ?

画像の縮尺は 何 m/px ?



Java#Others


添付ファイル: filemap1.png 2618件 [詳細] filestaticmap.png 2375件 [詳細] filemap2.png 2424件 [詳細] filememo.jpeg 2263件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2011-06-07 (火) 02:31:25 (4701d)
Short-URL: https://at-sushi.com:443/pukiwiki/index.php?cmd=s&k=9c8404ef60
ISBN10
ISBN13
9784061426061