ramnathv / rMaps

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

Use local TopoJSON URL? #26

Closed joelgombin closed 10 years ago

joelgombin commented 10 years ago

When using a custom TopoJSON file, is it possible to reference a relative path to the topoJSON file, rather than having to upload it to, e.g., github? In other words, I guess my question is, what is the root of the server used by rMaps?

ramnathv commented 10 years ago

You should be able to use relative paths to the topojson file. This wont work currently from your local computer since, only the HTML file generated gets copied to a temporary folder, from where a local webserver gets launched. I am working on a way to allow other files to get copied too, so that the relative references don't break.

Does this make sense?

joelgombin commented 10 years ago

yes, in combination with your other answer, that makes great sense! Thanks!

joelgombin commented 10 years ago

Hi Ramnath,

this may be of interest to you or others willing to use local topojson files: I created a small function to convert R SpatialPolygonsDataFrame files to topojson: https://github.com/joelgombin/toTopoJSON.

ramnathv commented 10 years ago

@joelgombin That looks great. You will want to take a look at the togeojson package that attempts to consolidate all functions required to deal with converting R objects to geojson/topojson.

joelgombin commented 10 years ago

I've seen it. I'd be happy if @sckott or the guys at @ropensci want to integrate my code in their package.

sckott commented 10 years ago

Great, thanks @joelgombin - I'll have a look very soon