window.onload = initAll;
function initAll() {
  
  $.getJSON("../data/citylist.json", buildCityLocation);
  
  function buildCityLocation(citylist) {
    var citylistLocation = {};
    var f = 0;
    
    /* AMap Geocoder does not return correct location values for some cities. */
    var preDefinedLocation = {
      "台北": {
        "lng": 121.519421,
        "lat": 25.036553,
      },
      "高雄": {
        "lng": 120.283515,
        "lat": 22.638614
      }
    };
    
    AMap.service(["AMap.Geocoder"], function() {
      var geocoder = new AMap.Geocoder();
      for(var i = 0; i < citylist.length; i++) {
        (function(i){
          var thisCity = citylist[i];
          geocoder.getLocation(thisCity, function(status, result){
            f++;
            if(status === 'complete' && result.info === 'OK'){
              var thisLocation = preDefinedLocation[thisCity] ? preDefinedLocation[thisCity] : result.geocodes[0].location;
              citylistLocation[thisCity] = {
                "point": {
                  "y": thisLocation.lat * 100000,
                  "x": thisLocation.lng * 100000
                }
              };
            } else {
              console.warn("Error:", thisCity, i);
              citylistLocation[thisCity] = {
                "point": {
                  "y": 0,
                  "x": 0
                }
              };
            }
            if (f == citylist.length) {
              console.log();
              document.getElementById("container").value = JSON.stringify(citylistLocation);
            }
          });
        })(i);
      }
      
    });
  }
}

@@ -315,16 +315,17 @@
      %22%E5%8F%B0%E5%8C%97
+%E5%B8%82
 %22: %7B%0A   
@@ -392,16 +392,17 @@
      %22%E9%AB%98%E9%9B%84
+%E5%B8%82
 %22: %7B%0A   
@@ -754,16 +754,83 @@
    f++;%0A
+            var predefinedThisCity = preDefinedLocation%5BthisCity%5D;%0A
         
@@ -924,64 +924,44 @@
  pre
-D
+d
 efined
-Location%5Bt
+T
 hisCity
-%5D
  ? pre
-D
+d
 efined
-Location%5Bt
+T
 hisCity
-%5D
  : r
@@ -1365,32 +1365,124 @@
 y%22: 
-0,%0A                  %22x%22
+predefinedThisCity ? predefinedThisCity.lat : 0,%0A                  %22x%22: predefinedThisCity ? predefinedThisCity.lng 
 : 0%0A
@@ -1574,37 +1574,8 @@
 ) %7B%0A
-              console.log();%0A
     

Update build-citylocation-amap.js