Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge two svg path elements programmatically

I am rendering a map out of SVG paths (using jVectormap).

There are cases where one region has to be merged with the neighboring region.

Unfortunately both regions don't touch each other and I have to interpolate to fill the space in between.

Merge two regions into one

jVectormap uses very simple SVG paths with M to set the the absolute startpoint and l to connect relative points.

Does any of the SVG libraries cover such an operation?

like image 921
jantimon Avatar asked Mar 18 '13 09:03

jantimon


1 Answers

I haven't tried this, but you may get around it by running the converter at jVectormap with the following parameters:

--buffer_distance=0
--where="ISO='region_1' OR ISO='region_2'"

Where region_1 and region_2 are the two regions that you need to merge.

Solving the problem this way also means that the generated SVG paths are true to the original coordinates, whereas a following fix may lead to some (probably minor) inconsistencies.

like image 150
mzedeler Avatar answered Nov 15 '22 13:11

mzedeler