score:0

I didn't look too closely at the linked question or your current calculations. Instead, I think the calculations can be simplified to:

function getElementCoords(element) {
// translate on node
var trans = d3.transform(d3.select(element).attr('transform')).translate,
// transform on parent "zoom" container
transFormParent = d3.transform(d3.select(element.parentNode).attr('transform')),
// translate on zoom container
transParent = transFormParent.translate,
// scale on zoom container
scaleParent = transFormParent.scale,
// final position of node
pos = {
x: trans[0] + transParent[0]/scaleParent[0],
y: trans[1] + transParent[1]/scaleParent[1]
};

return pos;
}

Call it as:

function click(d) {
console.log(getElementCoords(this));
}

Updated fiddle.

EDITS

@Christian pointed out in the comments, my math was off, should have been:

function getElementCoords(element) {
// translate on node
var trans = d3.transform(d3.select(element).attr('transform')).translate,
// transform on parent "zoom" container
transFormParent = d3.transform(d3.select(element.parentNode).attr('transform')),
// translate on zoom container
transParent = transFormParent.translate,
// scale on zoom container
scaleParent = transFormParent.scale,
// final position of node
pos = {
x: trans[0] * scaleParent[0] + transParent[0],
y: trans[1] * scaleParent[1] + transParent[1]
};

return pos;
}