var svg = '../sources/access points_redrawn-0.1.0-convert.svg'; var fs = require('fs'); svg = fs.readFileSync(svg, 'utf8'); var image = svg.match(/\/g)[0]; var w = parseFloat(image.match(/width\=\"(.*?)\"/)[1]); var h = parseFloat(image.match(/height\=\"(.*?)\"/)[1]); var matrix = image.match(/matrix\((.*?)\)/)[1].split(' '); matrix = matrix.map(function (v) { return parseFloat(v) }); var width = w*matrix[0] + h*matrix[1]; var height = w*matrix[2] + h*matrix[3]; var x0 = matrix[4]; var y0 = matrix[5]; svg = svg.split('\r\n'); var group = ''; var accesspoints = {}; svg.forEach(function (line) { if (line.match(/\/) != null) { group = ''; } //console.log(line); }); fs.writeFileSync('../cleaned/accesspoints.json', JSON.stringify(accesspoints, null, '\t'), 'utf8');