ramnathv / rMaps

Interactive Maps from R
http://rmaps.github.io
389 stars 194 forks source link

Using custom maps #85

Closed danwwilson closed 9 years ago

danwwilson commented 9 years ago

I am trying to replicate the outcomes reached from issue #6 however I can't seem to get my map to display.

My code is

library(rMaps)

maps <- Datamaps$new()
maps$set(geographyConfig = list(dataurl="https://www.dropbox.com/s/3xssqrf5sy7de64/australia.json"),
         scope="states",
         setProjectction = '#! function( element, options ) {
           var projection, path;
         projection = d3.geo.mercator()
         .center([-25, 133])
         .scale(element.offsetWidth)
         .translate([element.offsetWidth / 2, element.offsetHeight / 2]);

         path = d3.geo.path().projection( projection );
         return {path: path, projection: projection};
         } !#'
  )

maps

At this point I am just trying to get my map to display. Prior to trying to doing a choropleth based on data I have for the states. Any assistance would be greatly appreciated. As a side note I have managed to get my custom topojson to show on the screen following Mike Bostock's tutorial (http://bost.ocks.org/mike/map/).

Ultimately I'd love to be able to do this using a leaflet map to sit underneath it all and show a greater level of detail, but will be happy just getting this bit working to start with.

ramnathv commented 9 years ago

I think you just have a typo dataUrl. Another issue you might run into is that of cross-origin requests being disallowed. If you are saving the map, I would recommend putting the json file in the same path, to prevent the issue.