{"id":2462,"date":"2013-01-31T13:00:15","date_gmt":"2013-01-31T04:00:15","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=2462"},"modified":"2017-11-06T11:37:43","modified_gmt":"2017-11-06T02:37:43","slug":"post-2462","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3-js\/2462","title":{"rendered":"\u3010D3.js\u3011 Satellite Projection\uff08\u885b\u661f\u4fef\u77b0\u56f3\uff09\u3066\u3059\u3068"},"content":{"rendered":"<p><a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite1.jpg\" alt=\"satellite1\" width=\"968\" height=\"733\" class=\"aligncenter size-full wp-image-2463\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite1.jpg 968w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite1-198x150.jpg 198w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite1-768x582.jpg 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/a><\/p>\n<p>D3.js\u306b\u306f\u4e0a\u8a18\u306e\u3088\u3046\u306a\u5730\u56f3\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306eProjection(\u6295\u5f71\u6cd5)\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u2026\u2026\u306a\u304b\u306a\u304b\u601d\u3046\u3088\u3046\u306b\u4f7f\u3044\u3053\u306a\u305b\u307e\u305b\u3093\u3002<br \/>\n\u6295\u5f71\u6cd5\u3092\u6307\u5b9a\u3059\u308b\u969b\u306e\u4e00\u756a\u96e3\u3057\u3044\u30dd\u30a4\u30f3\u30c8\u306f\u6b63\u3057\u3044\u6570\u5024\u3092\u6307\u5b9a\u3057\u306a\u3044\u3068\u3001\u3059\u3050\u5730\u56f3\u304c\u753b\u9762\u5916\u3078\u6d88\u3048\u3066\u3057\u307e\u3046\u3068\u3053\u308d\u3067\u3059\u306d\u3002<\/p>\n<p>Satellite Projection\u306e\u5404\u5024(rotate\u3084tilt\u306a\u3069\uff09\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u3069\u306e\u3088\u3046\u306b\u5730\u56f3\u306e\u898b\u3048\u65b9\u304c\u5909\u308f\u308b\u306e\u304b\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u30c6\u30b9\u30c8\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/d3js\/geo_example\/geo4\/\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite12.jpg\" alt=\"satellite12\" width=\"1265\" height=\"829\" class=\"aligncenter size-full wp-image-2464\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite12.jpg 1265w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite12-229x150.jpg 229w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite12-768x503.jpg 768w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/01\/satellite12-1024x671.jpg 1024w\" sizes=\"auto, (max-width: 1265px) 100vw, 1265px\" \/><\/a><\/p>\n<pre class=\"lang:js decode:true \" >\r\n\r\nvar path, map, xy;\r\nvar map = d3.select(&quot;body&quot;).append(&quot;svg:svg&quot;).attr(&quot;width&quot;, 960).attr(&quot;height&quot;, 600); \/\/\u5730\u56f3\u7528\u306e\u30b9\u30c6\u30fc\u30b8(SVG\u30bf\u30b0)\u3092\u4f5c\u6210\r\n\r\nd3.json(&quot;japan.geojson&quot;, function(json) {\r\n   map.selectAll(&quot;path&quot;)\r\n            .data(json.features)\r\n            .enter()\r\n            .append(&quot;svg:path&quot;)\r\n\t\t\t.attr(&quot;class&quot;, &quot;base&quot;);\r\n\t\t\t\r\n\tdraw(80000, [45.00, -10, -50], 60, 200);\r\n\t\t\t\r\n});\r\n\r\n\r\nfunction draw(scale, rotate, tilt, clipAngle){\r\n\r\n\tprojection = d3.geo.satellite()  \/\/Satellite Projection\u306e\u6307\u5b9a\r\n\t\t.center([139.0032936, 36.3219088])\r\n\t\t.scale(scale)\r\n\t\t.rotate(rotate) \/\/3\u8ef8\u306e\u56de\u8ee2\u89d2\r\n\t\t.tilt(tilt) \/\/\u8996\u70b9\u306e\u50be\u304d\uff1f\r\n\t\t.clipAngle(clipAngle) \/\/\u5730\u56f3\u306e\u8868\u793a\u7bc4\u56f2\u3092\u30ab\u30c3\u30c8\u3059\u308b\u89d2\u5ea6\uff1f\r\n\r\n\r\n\tpath = d3.geo.path().projection(projection);\u3000\r\n\r\n\td3.selectAll('.base')\r\n\t\t.transition()\r\n\t\t.attr(&quot;d&quot;, path)  \r\n\t\t.attr(&quot;fill-opacity&quot;, 1)\r\n\t\t.attr(&quot;fill&quot;, &quot;green&quot;)\r\n\t\t.attr(&quot;stroke&quot;, &quot;#222&quot;);\r\n\r\n\t\t\t\r\n}\r\n\r\nd3.selectAll('input').on('change', function(d){\r\n\tvar scale = document.getElementById(&quot;scale&quot;).value; \u3000\/\/\u3000d3.select(this).attr('value') \/\/d3.select\u3060\u3068\u306a\u305c\u304b\u30b9\u30e9\u30a4\u30c0\u30fc\u306evalue\u5024\u304c\u3046\u307e\u304f\u53d6\u308c\u306a\u3044\u3002\r\n\td3.select('#scaleValue').attr(&quot;value&quot;, scale);\r\n\tvar rotate = [];\r\n\trotate.push(document.getElementById(&quot;rotate1&quot;).value);\r\n\trotate.push(document.getElementById(&quot;rotate2&quot;).value);\r\n\trotate.push(document.getElementById(&quot;rotate3&quot;).value);\r\n\td3.select('#rotate1Value').attr(&quot;value&quot;, rotate[0]);\r\n\td3.select('#rotate2Value').attr(&quot;value&quot;, rotate[1]);\r\n\td3.select('#rotate3Value').attr(&quot;value&quot;, rotate[2]);\r\n\tvar tilt = document.getElementById(&quot;tilt&quot;).value; \u3000\r\n\td3.select('#tiltValue').attr(&quot;value&quot;, tilt);\r\n\tvar clipAngle = document.getElementById(&quot;clipAngle&quot;).value; \u3000\r\n\td3.select('#clipAngleValue').attr(&quot;value&quot;, clipAngle);\r\n\r\n\tdraw(scale, rotate, tilt, clipAngle);\r\n});<\/pre>\n<p>Chrome\u3067\u3057\u304b\u52d5\u4f5c\u78ba\u8a8d\u3057\u3066\u307e\u305b\u3093\u3002<br \/>\n<a href=\"http:\/\/shimz.me\/example\/d3js\/geo_example\/geo4\/\">example<\/a><\/p>\n<p>\u5404\u5024\u306e\u30b9\u30e9\u30a4\u30c0\u30fc\u3092\u5909\u66f4\u3059\u308b\u3068\u5730\u56f3\u306b\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u65e5\u672c\u5730\u56f3\u306e\u30c7\u30fc\u30bf\u306f\u3001<a href=\"http:\/\/www.diva-gis.org\/gdata\">DIVA-GIS<\/a>\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u3082\u306e\u3092\u3001<a href=\"http:\/\/mapshaper.com\/test\/MapShaper.swf\">MapShaper<\/a>\u3067\u8efd\u304f\u3057\u3066Quantum GIS\u3067GeoJSON\u306b\u5909\u63db\u3059\u308b\u3068\u3044\u3046\u3044\u3064\u3082\u306e\u6d41\u308c\u3067\u3059\u3002<br \/>\n\u8a73\u3057\u304f\u306f<span class=\"removed_link\" title=\"https:\/\/gunmagisgeek.com\/blog\/d3-js\/2379\">\u3053\u3061\u3089<\/span>\u306e\u300cSHAPE\u30c7\u30fc\u30bf\u306e\u7c21\u7d20\u5316\u300d\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>D3.js\u306b\u306f\u4e0a\u8a18\u306e\u3088\u3046\u306a\u5730\u56f3\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306ePr&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2463,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-2462","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-d3-js","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=2462"}],"version-history":[{"count":8,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2462\/revisions"}],"predecessor-version":[{"id":2471,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2462\/revisions\/2471"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/2463"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=2462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=2462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=2462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}