<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="style.css">
    <script src="//cdnjs.cloudflare.com/ajax/libs/d3/4.1.1/d3.min.js"></script>
  </head>
  <body>
    <h1>Hello Plunker!</h1>
    <script src="script.js"></script>
  </body>
</html>





d3.json("https://msearch.gsi.go.jp/address-search/AddressSearch?q=%E6%9C%AD%E5%B9%8C%E9%A7%85", function(error, json) {
  var th = ['title', 'lat', 'lng'];
  var table = d3.select("body").append("table").attr("border", "1")
  table.append("thead").append("tr").selectAll("th").data(th).enter().append("th").text(function(d) {
    return d;
  });
  var w = json;
	for (var i = 0; i < w.length; i++)
	{
	  var title = w[i].properties.title;
		var lat = w[i].geometry.coordinates[1];
		var lng = w[i].geometry.coordinates[0];
		var item = [title, lat, lng];
    table.append("tbody").append("tr").selectAll("td").data(item).enter().append("td").text(function(d) {
      return d;
    });
	}
});

/*
[{
  "geometry": {
    "coordinates": [141.354309, 43.063042],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "",
    "title": "北海道札幌市"
  }
}, {
  "geometry": {
    "coordinates": [141.3499316, 43.06682465],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "01101",
    "title": "中央警察署札幌駅前交番"
  }
}, {
  "geometry": {
    "coordinates": [141.3503861, 43.07004996],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "01102",
    "title": "北警察署札幌駅北口交番"
  }
}, {
  "geometry": {
    "coordinates": [141.351173694444, 43.0686718333333],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "01102",
    "title": "札幌駅"
  }
}, {
  "geometry": {
    "coordinates": [141.3519002, 43.06904808],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "01102",
    "title": "札幌駅パセオ郵便局"
  }
}, {
  "geometry": {
    "coordinates": [141.384829777778, 43.0517861944444],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "01104",
    "title": "東札幌駅"
  }
}, {
  "geometry": {
    "coordinates": [141.472467318889, 43.0385570441667],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "01108",
    "title": "新札幌駅"
  }
}, {
  "geometry": {
    "coordinates": [141.47208336, 43.03918904],
    "type": "Point"
  },
  "type": "Feature",
  "properties": {
    "addressCode": "01108",
    "title": "新札幌駅デュオ郵便局"
  }
}]
*/
/* Styles go here */