score:22
Assuming you can ignore the stated restriction of manipulating an existing SVG image (which seems like an arbitrary restriction given the ready availability of cartographic boundaries in more easy-to-manipulate formats…), you can use topojson.mesh to merge multiple polygons. Though, note this approach has a few limitations as described in this example:
Another simple approach is to just draw the highlighted polygons twice: once with a thick black stroke and no fill, and a second time on top with orange fill and no stroke. This achieves the same effect without any need for topological manipulation:
I suppose if you really had to, you could reach into the SVG element and do the same thing by extracting the vector data, but it will be easier if you start from clean data.
Source: stackoverflow.com
Related Query
- D3: Merge interior svg paths?
- intersecting svg closed paths
- d3.js foreach loop on all the paths contained in a svg
- SVG thick curved paths not behaving as expected
- d3 custom bar chart bars using svg paths instead of rects
- d3 create svg from JSON paths
- How can I apply a clipPath in SVG with multiple paths and NOT clip out the area between the paths?
- Determine if object of (x,y) points fall inside of SVG paths
- D3 svg paths overlapping
- trying to get svg paths to flow smoothly
- Make rough svg paths smoother
- Draw SVG image on paths but as big as needed
- D3: How can I cause the stroke of an SVG path generated with D3 to be clipped to the interior of the same path?
- D3 adds GeoJSON paths to SVG but nothing displays
- Parsing error when drawing SVG paths from GeoJSON
- Passing SVG paths with template syntax in angular
- In D3, how to use SVG files as DOM objects with bound data and paths still exposed?
- How to manipulate specific SVG Paths in D3.js
- Color svg paths based on position along gradient in D3
- How can I get custom SVG paths to zoom correctly in D3?
- circular arc paths with svg
- How to merge paths with translate() values to a single one (D3 / SVG)?
- How to centre markers on the svg map paths
- D3 map - combine two disjoint svg polygon paths into one path
- How can I remove or replace SVG content?
- Resize svg when window is resized in d3.js
- How to add a tooltip to an svg graphic?
- How do I save/export an SVG file after creating an SVG with D3.js (IE, safari and chrome)?
- Updating SVG Element Z-Index With D3
- D3 Appending Text to a SVG Rectangle
More Query from same tag
- D3 axis label rotate transition not smooth
- Differing values for d3.scale.pow(0.5) versus d3.scale.sqrt()
- Loading external csv file in jsfiddle
- D3: What projection am I using? / How to simplify with a null projection?
- d3 - data - how to iterate over nested objects
- Modify Cartesian DIstortion for D3js V4
- Simple way to represent force/flow directed, weighted graph?
- D3 markers are not displayed proberly on Firefox but on Chrome
- Acessing selected points using lasso
- Do d3 elements need to be redefined with repeated code?
- D3.JS: Format as currency euro
- nvd3 - how to set y axis to default values
- D3.js - why mouseover and mouse out fired for each child elements?
- pan d3.js graph
- Updating chart.ygrids in Billboard.js does not update the class
- Reference .json file for external dataset in ng2-nvd3
- D3.js v4+ : truncate text to fit in fixed space
- d3 .csv with a lot of data, draw just for one month
- updating d3 data using intervals
- Get attributes of existing SVG elements and bind as data with d3.js
- Multiple sums of object efficiently d3.js
- Why does d3 axis class name change axis format?
- Plotting data on quadrilateral area
- limit a voronoi diagram within country border in d3.js
- Add different images for nodes in d3 v4 network graph
- Extend axis on c3.js
- circle location different when zoom or drag the d3 map?
- Hide data points in nvd3.js scatter chart by shape
- Finding time ranges which intersect with given time range
- D3 - adding grid to simple line chart