aasdelat Posted April 23, 2015 Report Share Posted April 23, 2015 (edited) 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 April 25, 2015 by aasdelat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.