Your shadows are being clipped by the filter region of the underlying SVG Filter. By default filter effects are shown in a 10% overflow region around the filtered shape. Your drop shadows on the smaller shapes are too big and are overflowing that region. This is causing the edges. You need to add an explicit filter region and make it bigger. This will expand the filter region to a 20% region surrounding the shape:
var filter = defs.append("filter").attr("id", "schaduw") .attr("width", 1.4)
.attr("height",1.4) .attr("x",-0.2) .attr("y",-0.2);
If you want a shadow that is proportional to the filtered element, you do not need to compute the size of anything. SVG has a built-in ability to do relative sizing by defining your units in objectBoundingBox units. Here youshould use objectBoundingBox units as your filter primitive units, not the (silent) default of userSpaceUnits ("regular" viewbox units). You need to restate the stdDeviation of the blur, as well as the offset of the offset in %'s of the originating element box expressed as a decimal:
var filter = defs.append("filter").attr("id", "schaduw") .attr("width", 1.4)
.attr("height",1.4) .attr("x",-0.2) .attr("y",-0.2)
.attr("primitiveUnits","objectBoundingBox");
filter.append("feGaussianBlur").attr("in", "SourceAlpha")
.attr("stdDeviation", .02).attr("result", "blur");
filter.append("feOffset").attr("in", "blur")
.attr("dx", .01)
.attr("dy", .01)
.attr("result", "offsetBlur");
var feMerge = filter.append("feMerge");
feMerge.append("feMergeNode").attr("in", "offsetBlur");
feMerge.append("feMergeNode").attr("in", "SourceGraphic");
Now, you'll notice that this looks a little weird - because as long as you want all shapes to look like they're on the same plane, your drop shadow size should be consistent across shapes no matter how small or large they are.