{"action":"created","issue":{"url":"https://api.github.com/repos/Turfjs/turf/issues/1496","repository_url":"https://api.github.com/repos/Turfjs/turf","labels_url":"https://api.github.com/repos/Turfjs/turf/issues/1496/labels{/name}","comments_url":"https://api.github.com/repos/Turfjs/turf/issues/1496/comments","events_url":"https://api.github.com/repos/Turfjs/turf/issues/1496/events","html_url":"https://github.com/Turfjs/turf/issues/1496","id":365129750,"node_id":"MDU6SXNzdWUzNjUxMjk3NTA=","number":1496,"title":"How to add pushpin inside of each cell of turf square grid?","user":{"login":"ShahriatHossain","id":10559339,"node_id":"MDQ6VXNlcjEwNTU5MzM5","avatar_url":"https://avatars1.githubusercontent.com/u/10559339?v=4","gravatar_id":"","url":"https://api.github.com/users/ShahriatHossain","html_url":"https://github.com/ShahriatHossain","followers_url":"https://api.github.com/users/ShahriatHossain/followers","following_url":"https://api.github.com/users/ShahriatHossain/following{/other_user}","gists_url":"https://api.github.com/users/ShahriatHossain/gists{/gist_id}","starred_url":"https://api.github.com/users/ShahriatHossain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShahriatHossain/subscriptions","organizations_url":"https://api.github.com/users/ShahriatHossain/orgs","repos_url":"https://api.github.com/users/ShahriatHossain/repos","events_url":"https://api.github.com/users/ShahriatHossain/events{/privacy}","received_events_url":"https://api.github.com/users/ShahriatHossain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-29T12:51:28Z","updated_at":"2018-09-29T18:14:44Z","closed_at":null,"author_association":"NONE","body":"I am using turf and openlayers together. I am creating square grid of turf on openlayers map which works fine. But I want to add push pin for each cell of square grid. Is it possible? Need experts help. Thanks.\r\n\r\nHere is the code sample of turf's square grid:\r\n\r\n```\r\nvar bbox = [-95, 30 ,-85, 40];\r\nvar cellSide = 50;\r\nvar options = {units: 'miles'};\r\n\r\nvar squareGrid = turf.squareGrid(bbox, cellSide, options);\r\n\r\n//addToMap\r\nvar addToMap = [squareGrid]\r\n```"},"comment":{"url":"https://api.github.com/repos/Turfjs/turf/issues/comments/425665124","html_url":"https://github.com/Turfjs/turf/issues/1496#issuecomment-425665124","issue_url":"https://api.github.com/repos/Turfjs/turf/issues/1496","id":425665124,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTY2NTEyNA==","user":{"login":"stebogit","id":12717225,"node_id":"MDQ6VXNlcjEyNzE3MjI1","avatar_url":"https://avatars3.githubusercontent.com/u/12717225?v=4","gravatar_id":"","url":"https://api.github.com/users/stebogit","html_url":"https://github.com/stebogit","followers_url":"https://api.github.com/users/stebogit/followers","following_url":"https://api.github.com/users/stebogit/following{/other_user}","gists_url":"https://api.github.com/users/stebogit/gists{/gist_id}","starred_url":"https://api.github.com/users/stebogit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stebogit/subscriptions","organizations_url":"https://api.github.com/users/stebogit/orgs","repos_url":"https://api.github.com/users/stebogit/repos","events_url":"https://api.github.com/users/stebogit/events{/privacy}","received_events_url":"https://api.github.com/users/stebogit/received_events","type":"User","site_admin":false},"created_at":"2018-09-29T18:14:44Z","updated_at":"2018-09-29T18:14:44Z","author_association":"COLLABORATOR","body":"@ShahriatHossain I'm not familiar with OpenLayers and I'm not sure what a pushpin is, but this should give you one possible solution to define a point in the middle of each cell of the grid:\r\n```js\r\nvar bbox = [-95, 30 ,-85, 40];\r\nvar cellSide = 50;\r\nvar options = {units: 'miles'};\r\n\r\nvar grid = turf.squareGrid(bbox, cellSide, options);\r\n\r\nvar pins = [];\r\nturf.featureEach(grid, function (cell, idx) {\r\n\tconsole.log(cell);\r\n\tvar pin = turf.centroid(cell, {\"marker-color\": \"#00F\"});\r\n  pins.push(pin);\r\n});\r\n```\r\nIf you need more OpenLayers specific information I suggest you to post on StackOverflow or other map specific websites."}}
{"actor":{"display_login":"stebogit"}}