2017-11-15 4 views
1

opentripplannerサーバーからたくさんのアイソクロンをダウンロードしようとしています。 制限事項:外部ツールやインストールは不可能です。クライアントはWindows 7です。.batファイルを作成するには、自作のExcelツールを使用します。カスタムヘッダーでバッチでファイルをダウンロードする

デフォルトの応答は.jsonファイル形式です。これはbitsadminでうまく動作します:

bitsadmin /Transfer Download_Isochrone_1 /download /priority normal http://exampleserver.com/otp-rest-servlet/ws/isochrone?routerId=bordeaux^&algorithm=accSampling^&fromPlace=47.059,-0.880^&date=2013/10/01^&time=12:00:00^&maxWalkDistance=1000^&mode=WALK,TRANSIT^&cutoffSec=1800^&cutoffSec=3600 c:\username\downloads\Isochrone_1.json 
bitsadmin /Transfer Download_Isochrone_2 /download /priority normal http://exampleserver.com/otp-rest-servlet/ws/isochrone?routerId=bordeaux^&algorithm=accSampling^&fromPlace=47.089,-0.881^&date=2013/10/01^&time=12:00:00^&maxWalkDistance=1000^&mode=WALK,TRANSIT&cutoffSec=1800^&cutoffSec=3600 c:\username\downloads\Isochrone_2.json 
bitsadmin /Transfer Download_Isochrone_3 /download /priority normal http://exampleserver.com/otp-rest-servlet/ws/isochrone?routerId=bordeaux^&algorithm=accSampling^&fromPlace=47.159,-0.882^&date=2013/10/01^&time=12:00:00^&maxWalkDistance=1000^&mode=WALK,TRANSIT^&cutoffSec=1800^&cutoffSec=3600 c:\username\downloads\Isochrone_3.json 

しかし、.shp(.zip)はカスタムヘッダーを使用することで可能です。 ( "Accept:application/x-zip-compressed")。これはすでにブラウザプラグインを介して単一のアイソクロナスで実行されています。 だから私は試しました

bitsadmin /Create /Download Download_Isochrones 
bitsadmin /SetCustomHeader Download_Isochrones "Accept: application/x-zip-compressed" 
bitsadmin /Addfile Download_Isochrones http://exampleserver.com/otp-rest-servlet/ws/isochrone?routerId=bordeaux^&algorithm=accSampling^&fromPlace=47.059,-0.880^&date=2013/10/01^&time=12:00:00^&maxWalkDistance=1000^&mode=WALK,TRANSIT^&cutoffSec=1800^&cutoffSec=3600 c:\username\downloads\Isochrone_1.txt 
bitsadmin /Addfile Download_Isochrones http://exampleserver.com/otp-rest-servlet/ws/isochrone?routerId=bordeaux^&algorithm=accSampling^&fromPlace=47.089,-0.881^&date=2013/10/01^&time=12:00:00^&maxWalkDistance=1000^&mode=WALK,TRANSIT&cutoffSec=1800^&cutoffSec=3600 c:\username\downloads\Isochrone_2.txt 
bitsadmin /Addfile Download_Isochrones http://exampleserver.com/otp-rest-servlet/ws/isochrone?routerId=bordeaux^&algorithm=accSampling^&fromPlace=47.159,-0.882^&date=2013/10/01^&time=12:00:00^&maxWalkDistance=1000^&mode=WALK,TRANSIT^&cutoffSec=1800^&cutoffSec=3600 c:\username\downloads\Isochrone_3.txt 
bitsadmin /Resume Download_Isochrones 
bitsadmin /Complete Download_Isochrones 

しかし、それは動作しません。実際には、 "/ Addfile"はこの目的のためにまったく動作しないようです。 (テスト目的で.txt拡張子を使用) /setcustomheaderとのやりとり/転送がどうにかできますか?上記のコードで間違いを犯しましたか?あるいは、win7外部ツールなしでこれを行う他の可能性はありますか?関心の場合は 、HERESにOpenTripPlannerドキュメント:http://dev.opentripplanner.org/apidoc/1.0.0/resource_LIsochrone.html

答えて

1

winhttpjs.batで試してみてください。

#compression header 
Accept: application/x-zip-compressed 

call winhttpjs.bat "https://requestb.in/vp4p0gvp" -headers-file headers.txt -saveTo file.gzip 

あなたは次のように見て、同じディレクトリにあるheaders.txtファイルが必要になります結果を確認するには、https://requestb.inサイトにtest linkを作成しました。

+0

私の会社でそれを使用することを許可されていますが、ありがとうございます。とにかく、自宅で試してみましたが、うまく動作するように管理できませんでした。それを使用する方法に関する文書はありますか? – MrXsquared

+0

@MrXsquared - あなたに尋ねることができる問題がある場合は、ヘルプメッセージのみ。これはバイナリではなく、MITライセンスの下にあります。 – npocmaka

+0

winhhtpjs.batをダウンロードしてデスクトップに配置しました。最初のコードをtextfile.batにコピーし、2番目のコードをheaders.txtにコピーしました。 batを実行すると、cmdウィンドウが1秒未満でポップアップします。また、textfile.batを "call D:¥users¥desktop¥winhttpjs.bat" ht .... "に変更しようとしました。同じ結果です。管理者として実行すると変更されません。もちろん、winhttpjs.bat自体も実行しようとしました。また、1秒未満でポップアップして終了します。PowerShellで動かすのもうまくいきません。スクリプトよりもGISのほうがいいかもしれません:) – MrXsquared

関連する問題