{"action":"created","issue":{"url":"https://api.github.com/repos/Turfjs/turf/issues/1466","repository_url":"https://api.github.com/repos/Turfjs/turf","labels_url":"https://api.github.com/repos/Turfjs/turf/issues/1466/labels{/name}","comments_url":"https://api.github.com/repos/Turfjs/turf/issues/1466/comments","events_url":"https://api.github.com/repos/Turfjs/turf/issues/1466/events","html_url":"https://github.com/Turfjs/turf/issues/1466","id":353812017,"node_id":"MDU6SXNzdWUzNTM4MTIwMTc=","number":1466,"title":"Keep GeoJson Feature Collection properties with Centroid function","user":{"login":"sylvain-m","id":11629210,"node_id":"MDQ6VXNlcjExNjI5MjEw","avatar_url":"https://avatars1.githubusercontent.com/u/11629210?v=4","gravatar_id":"","url":"https://api.github.com/users/sylvain-m","html_url":"https://github.com/sylvain-m","followers_url":"https://api.github.com/users/sylvain-m/followers","following_url":"https://api.github.com/users/sylvain-m/following{/other_user}","gists_url":"https://api.github.com/users/sylvain-m/gists{/gist_id}","starred_url":"https://api.github.com/users/sylvain-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sylvain-m/subscriptions","organizations_url":"https://api.github.com/users/sylvain-m/orgs","repos_url":"https://api.github.com/users/sylvain-m/repos","events_url":"https://api.github.com/users/sylvain-m/events{/privacy}","received_events_url":"https://api.github.com/users/sylvain-m/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-24T14:42:56Z","updated_at":"2018-08-24T15:13:49Z","closed_at":null,"author_association":"NONE","body":"_(sorry, but i am totally beginner in Javascript)_\r\n\r\nHello,\r\nI try to convert a Multipolygon GeoJson Feature Collection to centroid point layer.\r\nI succeed for geometries, but without keeping properties. However, I see in documentation it might be possible.\r\n\r\nHe is the function I wrote : \r\n \r\n```\r\nfunction ToCentroid(polyList) {\r\n\tvar centroidgroup = L.layerGroup();\r\n  for (var i = 0; i < polyList.length; ++i) {\r\n  var centroidtemp = turf.centroid(polyList[i].toGeoJSON());\r\n  centroidgroup.addLayer(L.geoJson(centroidtemp, {\r\n\t\t\t\t\tonEachFeature : onEachFeature,\r\n          }));\r\n    }\r\n  return centroidgroup;\r\n  }\r\n```\r\n\r\nI call this function like this : \r\n`var PointLayer = ToCentroid(PolygonLayer.getLayers()).addTo(map);`\r\n\r\nBut I don't know how to write the properties option for the `turf.centroid()` function.\r\n\r\nI tried with `polyList[i].feature.properties` but it did not work...\r\n\r\nCan someone help me ?\r\n\r\nHere is a JSFiddle test : \r\nhttp://jsfiddle.net/08xaeLdq/"},"comment":{"url":"https://api.github.com/repos/Turfjs/turf/issues/comments/415790016","html_url":"https://github.com/Turfjs/turf/issues/1466#issuecomment-415790016","issue_url":"https://api.github.com/repos/Turfjs/turf/issues/1466","id":415790016,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTc5MDAxNg==","user":{"login":"sylvain-m","id":11629210,"node_id":"MDQ6VXNlcjExNjI5MjEw","avatar_url":"https://avatars1.githubusercontent.com/u/11629210?v=4","gravatar_id":"","url":"https://api.github.com/users/sylvain-m","html_url":"https://github.com/sylvain-m","followers_url":"https://api.github.com/users/sylvain-m/followers","following_url":"https://api.github.com/users/sylvain-m/following{/other_user}","gists_url":"https://api.github.com/users/sylvain-m/gists{/gist_id}","starred_url":"https://api.github.com/users/sylvain-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sylvain-m/subscriptions","organizations_url":"https://api.github.com/users/sylvain-m/orgs","repos_url":"https://api.github.com/users/sylvain-m/repos","events_url":"https://api.github.com/users/sylvain-m/events{/privacy}","received_events_url":"https://api.github.com/users/sylvain-m/received_events","type":"User","site_admin":false},"created_at":"2018-08-24T15:13:49Z","updated_at":"2018-08-24T15:13:49Z","author_association":"NONE","body":"I tried `turf.centroid(polyList[i].toGeoJSON(), {properties : polyList[i].feature.properties})` but still don't work...\r\nI should not be far from the solution, but I think I need some help...  :stuck_out_tongue_winking_eye:"}}
{"actor":{"display_login":"sylvain-m"}}