2016-10-24 9 views
1

Bing Maps APIを使用して静的マップをダウンロードしようとしています。これはChromeからURLをロードするときに機能しますが、LinuxからwgetにカールしようとするとAuth Failedエラーが発生します。Bing Static MapをLinuxでダウンロードするには

URLは同じですが、何らかの理由でBingがLinuxからの呼び出しをブロックしていますか?私はそれがキータイプとは何かを持っている場合、私はへの公開ウェブサイトからいくつかを試してみたかわからない

Resolving dev.virtualearth.net (dev.virtualearth.net)... 131.253.14.8 
Connecting to dev.virtualearth.net (dev.virtualearth.net)|131.253.14.8|:80... connected. 
HTTP request sent, awaiting response... 401 Unauthorized 

Username/Password Authentication Failed. 
--2016-10-24 15:42:30-- http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/.../12?mapSize=340,500 
Reusing existing connection to dev.virtualearth.net:80. 
HTTP request sent, awaiting response... 401 Unauthorized 

Username/Password Authentication Failed. 

wget -O map.png http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/... 
curl -O map.png http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/... 

がエラー:

は、ここに私が試したコマンドですDev/Testでも動作しませんでした。

+1

地図画像を保存するのはBing Mapsの利用規約に違反していることに注意してください。それらを要求して表示することはできますが、後で使用するためにファイルシステムまたはデータベースに保存することはできません。 – rbrundritt

答えて

1

URLは引用符で(理由はエスケープする必要のあるクエリ文字列に&のシンボルの)ラップする必要がありますwget経由

wget 'http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/...' 

wget -O map.jpg 'http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/Bellevue%20Washington?mapLayer=TrafficFlow&key=<key>' 

カールする:

curl -o map.jpg 'http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/Bellevue%20Washington?mapLayer=TrafficFlow&key=<key>' 

Have been verified under Ubuntu 16.04

+1

どのように私は答えがとにかく簡単に何かを逃すことができます – Casper

関連する問題