1

I have converted .shp file into geojson file using rgdal, httr, leafletR packages

file <- "province" # shp file name
arg_file  <- readOGR(dsn = ".", "province") # destination require . to load from current directory

q.dat <- toGeoJSON(data = arg_file,  name = "argentina")

Now I have an argentina.geojson file

How can I read the geojson file directly next time without converting the .shp file to geojson again as it is taking a lot of time.

Thanks in advance

  • Maybe this will help: http://stackoverflow.com/questions/24183007/is-it-possible-to-read-geojson-or-topojson-file-in-r-to-draw-a-choropleth-map – MrFlick May 29 '15 at 22:21
  • You can try `geojsonio`, http://cran.rstudio.com/web/packages/geojsonio/ - meant to make this kind of thing easier, so you don't have to worry about the details (uses rgdal under the hood) – sckott May 29 '15 at 22:49
  • Thank Flick for the link, those work independely but doesn't work in collaboration with leaflet for me. – analytics3345 May 30 '15 at 06:33
  • Scott, i installed the package and find file <- system.file("examples", "california.geojson", package = "geojsonio") out <- geojson_read(file) I don't know what examples is for , secondly it wasn't reading even when I have geojson file in the root directory. Thank – analytics3345 May 30 '15 at 06:34

0 Answers0