2

I have a bunch of SVG files, each containing a collection of polylines that I want to measure the lengths of. This is one typical polyline:

<path d="M 1828.0 1476.0 1838.0 1384.0 1771.0 1360.0 1730.0 1334.0 1687.0 1344.0 1654.0 1352.0 " stroke="rgb(255,200,0)" fill="none" stroke-width="8.0"/>

In each SVG are a couple hundred of these lines.

Are there Python SVG handling modules that can process this and measure the lengths? If they don't exist, are there existing solutions for parsing SVG files so I only need to develop something for measuring (and not parsing)? If there are such modules, I would appreciate any tips on how to approach this problem. I don't have a strong preference for Python 2 or 3, though I am new to Python and most of what I've done is in Python 2.

Thank you very much!

P.S. I have found svgwrite and pysvg, but looks like they both write SVG files and don't really parse them or do any measurements.

4

0 に答える 0