Jump to content
Sign in to follow this  
aasdelat

Kartograph.js or bad svg file

Recommended Posts

Hello, all:

 

I have to use a map interactively: the user clicks on a position, and a new graph comes up with information about that point.

 

I have to use R to generate the secondary graphs (not a map), but the first one (a map) is already created.

 

So, I think that the best solution is to use the SpiderMoneky package to comunicate between R and JavaScript.

 

Is this a good idea?.

 

But now the problem: I coded the following html page:

    <html>
        <head>
            <script src="jquery.min.js"></script>
            <script src="raphael-min.js"></script>
            <script src="kartograph.min.js"></script>
        
            <script type="text/javascript">
            function loadMap(){
                var map = kartograph.map('#map', 600, 0);
    
                map.loadMap('map.svg', function() {
                     map.addLayer('page');
                });
            }
            </script>
        </head>
        <body onLoad="loadMap()">
            <div id="map"></div>
        </body>
    </html>

The file map.svg can be downloaded from here.

 

But the code above, doesn't display anything.

 

However, if I use the this file instead, and change the code accordingly (map.svg -> DEU.svg and page -> admin1) it is correctly displayed.

 

Perhaps there is a difference between the two files that makes necessary to write some other commands in order to load the first one (map.svg) correctly.

 

Does anybody know the reason for Kartograph.js to not to display map.svg?.

 

Is theer a better approach to this problem (interactive map in R)?.

 

Thaks a lot in advance.

Edited by aasdelat

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.