Get centroid from svg path data

1,824 views
Skip to first unread message

Oliver

unread,
Aug 21, 2012, 1:48:43 PM8/21/12
to d3...@googlegroups.com
Based on a svg world map from wikipedia  i need to calculate the centroid of every country. The d3 library supports a centorid method for paths. In the provided svg file the path coordinates of every country are included.
For example Germany: <path id="germany" d="M471.14,167.88l3.57-0.58v-2.52l2.99-0.49l1.64, ... ,167.88z"/>

How can i you use the attribute d of the svg data to calculate the centroid in D3 syntax?

Chris Viau

unread,
Aug 22, 2012, 10:47:09 AM8/22/12
to d3...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages