vdh_ant
vdh_ant

Reputation: 13156

Calculating SVG paths

I have a quite complex image map (made up of over 150 pieces) and I want to convert the coords within the map to SVG path standard format.

The reason why is I want to use the following instead of an image map http://raphaeljs.com/australia.html. But I need the coords to be in SVG path standard format.

How can I convert an image map to SVG coordinates?

Cheers Anthony

Upvotes: 6

Views: 6017

Answers (1)

russau
russau

Reputation: 9108

Assuming you are talking about a HTML image map? SVG path markup is very similar to what you gave in a HTML imagemap. Say you have:

<area shape="poly" alt="" coords="0,0,115,0,115,23,92,60,92,111,0,111" />

The same thing in path markup would be

M 0,0,115,0,115,23,92,60,92,111,0,111 Z

An uppercase M indicates that startPoint is an absolute value. The example you have linked to appears to hyphen separate the points with no spaces. So you might what to try something like

M0,0-115,0-115,23-92,60-92,111-0,111Z

Upvotes: 8

Related Questions