YouTube | Facebook | X(Twitter) | RSS

Locator を使用したバッチ ジオコーディング

2016/9/1 (木)

function doAddressToLocations() {
       
  var taskLocator = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
  taskLocator.on("addresses-to-locations-complete", showResults); //イベント ハンドリング
 
  //入力住所群
  var addresses = [{
    "OBJECTID": 0,
    "ADDRESS": "東京都港区芝公園4丁目2-8"
  }, {
    "OBJECTID": 1,
    "ADDRESS": "東京都港区芝公園4丁目2-8"
  }];
 
  var options = {
    addresses: addresses
  }
 
  taskLocator.addressesToLocations(options);  //タスクの実行
 
}
 
//検索結果
function showResults(candidates) {
  array.every(candidates.addresses, function (candidate) {
 
    // candidate から属性を取得
    var attributesCandidate = {
        address: candidate.address,
        score: candidate.score,
        locatorName: candidate.attributes.Loc_name
        geometryLocation = candidate.location;
    };
 
    console.log(attributesCandidate);
 
  return true;
 
  }   
}

関連記事

  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

-プログラミング, ArcGIS, 日記
-,

WINGFIELD since1981をもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む