SVG kartograph file

Asked

Viewed 101 times

3

Using kartograph, I want to load the SVG from this link: SVG. The first thing I noticed was the missing tag Metadata. So I copied this tag from another SVG file, but the image still doesn’t appear. Could someone look at the svg file from the link and tell me what is missing?

Below my html code.

<html>
    <head>
        <script src="../../js/jquery/jquery-1.9.1.min.js"></script>
        <script src="../../js/raphaeljs/raphael-min.js"></script>
        <script src="../../js/kartograph/kartograph.js"></script>
        <script>
                $(document).ready(function(){

                    var map = kartograph.map('#map');
                    map.loadMap('mymap.svg', function () {
                            map.addLayer("Terreno");
                    });
    });
        </script>
    </head>
    <body>
        <div id="map"></div>
    </body>
</html>
  • I haven’t tested this library yet, but I suppose because it’s Raphael.js you’re working with canvas combined with svg I’m sure?

  • I cannot say, here on the kartograph homepage[http://kartograph.org/] you have some examples

  • If my answer doesn’t help you, edit your question to add a functional example of the problem using the snippet (from the stackoverflow itself) or http://jsfiddle.net

2 answers

0

I can not reproduce the problem, so I will point out possible errors in the code:

  1. In your code you are using version 1.9.1 of Jquery <script src="../../js/jquery/jquery-1.9.1.min.js"></script>

    But kartograph uses version 1.10.2 <script type="text/javascript" src="/js/jquery-1.10.2.min.js"></script>

  2. In your code you can being using an outdated version of Raphael, kartograph uses "Raphael 2.1.0" (as I said "can", there’s no way to be sure)

  3. SVG is in a domain other than the current one, your SVG may be in a domain other than the page that is using "kartograph", this can cause problems with the "CORS"

Other possible problems

The files are not in the correct directory, to determine the fault analyze the Console of your browser, see how to do here: http://ggnome.com/wiki/Using_The_Browser_Error_Console If the Console shows any error, through this "error", you will know what the problem of your code.

  • 1 It is not the version of Jquery because it works using a svg of the site examples. 2 The version of Raphael I am using is the last available on the site. 3 the svg file is locally on the server I put the source url to access the file. I will do jsfiddle to play

  • @luckasx Friend is as I said "I will point out the possible", follow the indication of where it is written "Other possible problems", your question has no way to reproduce the problem, as I said in my first comment (where I speak "snippet (from the stackoverflow itself) or jsfiddle.net")

-1


The solution was to generate the map using Kartograph py from SHP files.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.