{"id":6377,"date":"2019-04-22T10:51:39","date_gmt":"2019-04-22T01:51:39","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=6377"},"modified":"2019-04-22T10:51:39","modified_gmt":"2019-04-22T01:51:39","slug":"turf-js%e6%8c%87%e5%ae%9a%e3%81%97%e3%81%9f%e7%af%84%e5%9b%b2%e3%81%ab%e7%ad%89%e9%96%93%e9%9a%94%e3%81%ab%e3%83%9d%e3%82%a4%e3%83%b3%e3%83%88%e3%83%9d%e3%82%a4%e3%83%b3%e3%83%88%e3%82%b0%e3%83%aa","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/leaflet-js\/6377","title":{"rendered":"[Turf.js]\u6307\u5b9a\u3057\u305f\u7bc4\u56f2\u306b\u7b49\u9593\u9694\u306b\u30dd\u30a4\u30f3\u30c8(\u30dd\u30a4\u30f3\u30c8\u30b0\u30ea\u30c3\u30c9)\u3092\u751f\u6210\u3059\u308b"},"content":{"rendered":"<h3>\u30dd\u30a4\u30f3\u30c8\u30b0\u30ea\u30c3\u30c9\u3092\u751f\u6210\u3059\u308b<\/h3>\n<p>bbox\u3067\u6307\u5b9a\u3057\u305f\u7bc4\u56f2\u306b\u3001\u4efb\u610f\u306e\u9593\u9694\u3067\u30dd\u30a4\u30f3\u30c8\u30b0\u30ea\u30c3\u30c9\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >var bbox = [-70.823364, -33.553984, -70.473175, -33.302986];\nvar pointGrid = turf.pointGrid(bbox, 3,  {units: 'kilometers'});\n\/\/-&gt; point grid geojson<\/pre>\n<h3>leaflet\u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2019\/04\/index.html-shimz.me-2019-04-22-10-49-33.png\" alt=\"Turf\u3092\u4f7f\u3063\u3066\u30dd\u30a4\u30f3\u30c8\u30b0\u30ea\u30c3\u30c9\u3092\u751f\u6210\u3059\u308b\" width=\"1003\" height=\"696\" class=\"alignnone size-full wp-image-6378 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2019\/04\/index.html-shimz.me-2019-04-22-10-49-33.png 1003w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2019\/04\/index.html-shimz.me-2019-04-22-10-49-33-216x150.png 216w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2019\/04\/index.html-shimz.me-2019-04-22-10-49-33-768x533.png 768w\" sizes=\"auto, (max-width: 1003px) 100vw, 1003px\" \/><\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/turf\/gridPoint\/\">example<\/a><\/p>\n<p>\u63cf\u753b\u30c4\u30fc\u30eb\uff08\u56db\u89d2\uff09\u3067\u63cf\u753b\u3055\u308c\u305f\u7bc4\u56f2\u3092\u30dd\u30a4\u30f3\u30c8\u30b0\u30ea\u30c3\u30c9\u3067\u57cb\u3081\u307e\u3059\u3002<br \/>\n\u3042\u307e\u308a\u5e83\u3044\u7bc4\u56f2\u3092\u9078\u629e\u3059\u308b\u3068\u3001\u51e6\u7406\u306e\u8ca0\u8377\u304c\u9ad8\u3059\u304e\u3066\u30d6\u30e9\u30a6\u30b6\u304c\u56fa\u307e\u308bor\u843d\u3061\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" title=\"index.html\" >var mymap = L.map('mapid').setView([36.3426631, 138.6092733], 13);\nL.tileLayer('https:\/\/api.tiles.mapbox.com\/v4\/{id}\/{z}\/{x}\/{y}.png?access_token={accessToken}', {\n    attribution: 'Map data &amp;copy; &lt;a href=\"https:\/\/www.openstreetmap.org\/\"&gt;OpenStreetMap&lt;\/a&gt; contributors, &lt;a href=\"https:\/\/creativecommons.org\/licenses\/by-sa\/2.0\/\"&gt;CC-BY-SA&lt;\/a&gt;, Imagery \u00a9 &lt;a href=\"https:\/\/www.mapbox.com\/\"&gt;Mapbox&lt;\/a&gt;',\n    maxZoom: 18,\n    id: 'mapbox.streets',\n    accessToken: 'Mapbox\u306e\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u8a18\u8f09'\n}).addTo(mymap);\n\n\nvar controler = mymap.pm.addControls({\n  position: 'topleft',\n  drawMarker:false,\n  drawPolyline:false,\n  drawRectangle:true,\n  drawPolygon:false,\n  drawCircle: false,\n  editMode:false,\n  dragMode:false,\n  cutPolygon:false,\n  removalMode:false,\n});\n\n\n\/\/\u56f3\u5f62\u304c\u751f\u6210\u3055\u308c\u305f\u6642\u306b\u767a\u706b\u3059\u308b\u30a4\u30d9\u30f3\u30c8\nmymap.on('pm:create', function(e){\n    \/\/\u751f\u6210\u3057\u305frectang\u306e\u5ea7\u6a19\u3092\u53d6\u5f97\u3059\u308b\n    var bbox = e.layer.getBounds().toBBoxString().split(\",\")\n        .map(function(d){ return +d });\n\n    \/\/\u30dd\u30a4\u30f3\u30c8\u30b0\u30ea\u30c3\u30c9\u3092\u4f5c\u6210\u3059\u308b\n    var pointGrid = turf.pointGrid(bbox, 0.5, {units: 'kilometers'});\n\n    L.geoJSON(pointGrid).addTo(mymap);\n\n\n\n});<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30dd\u30a4\u30f3\u30c8\u30b0\u30ea\u30c3\u30c9\u3092\u751f\u6210\u3059\u308b bbox\u3067\u6307\u5b9a\u3057\u305f\u7bc4\u56f2&hellip;<\/p>\n","protected":false},"author":1,"featured_media":6378,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55,62],"tags":[],"class_list":["post-6377","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-leaflet-js","category-turf-js","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/6377","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=6377"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/6377\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/6378"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=6377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=6377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=6377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}