kartograph / kartograph.org

website for kartograph mapping library
http://kartograph.org
281 stars 207 forks source link

Cannot read property 'getAttribute' Error #63

Open avanfeel opened 9 years ago

avanfeel commented 9 years ago

I get a "Uncaught TypeError: Cannot read property 'getAttribute' of undefined" error with this simple code:

var map = kartograph.map('#map', 600, 400);

map.loadMap('arg.svg', function() { // do something with your map, add layers etc. });

jeromepin commented 9 years ago

You can read this answer : either add metadata tag or use the 'addLayer' method if you generated your map with kartograph.py like :

var map = kartograph.map('#map', 600, 400);
map.loadMap('map.svg', function() {
    map.addLayer('my_layer_name_defined_for_kartograph.py', {
            styles: {
                    fill: 'blue',
                    stroke: 'red',
            }
    });
});