Resize GeoSVG in XML File Kartograph.js

86 Views Asked by At

I am trying to resize a geo svg in an xml file and am failing. I'v been trying to adjust the viewBox and height/width but cannot get it to work... I am basically trying to enlarge the svg for use with Kartograph.js. I got the FRA.svg file from KArtograph...

context path { fill: #eee; stroke: #bbb; } ]]>

Any help would be great, thanks!

1

There are 1 best solutions below

0
On

I hope you still need the answer.

I had the same problem resizing my world.svg on resizing the window. Basically the API of Kartograph.js is very uncomplete.

Just oversee the source, there you'll find a resize-function. In my case I came up with the following (including a timeout to not resizing the map continuously:

var worldMap = kartograph.map('#map');
worldMap.loadMap(worldSvg, function (map) {
        //some code
});

$(window).on('resize', function() {
    rtime = new Date();
    if (timeout === false) {
        timeout = true;
        setTimeout(resizeend, delta);
    }
});

function resizeend() {
    if (new Date() - rtime < delta) {
        setTimeout(resizeend, delta);
    } else {
        timeout = false;
        worldMap.resize($('#map').width(),$('#map').height());  
    }               
}

Works great for me.