2

I'm pretty new to using rgdal so I'm hoping this is something simple that I'm missing, but I've been googling around about it for a few hours and I can't figure out the issue.

Basically I'm trying to make a leaflet map in a shiny app, but I'm getting snarled right at the beginning, trying to load country data like so:

library(rgdal)

countries <- readOGR("https://raw.githubusercontent.com/datasets/geo boundaries-world-110m/master/countries.geojson", "OGRGeoJSON")

but every time I get the following error:

Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  : 
  Cannot open file

I've gone to the address and I see the raw geojson file there, so it's not a missing file. I've also downloaded the file manually into a data folder and then tried to access it with

countries <- readOGR("data/countries.geojson", "OGRGeoJSON")

and I get the same error. Any ideas would be much appreciated.

I'm running R on Windows 7.

seth127
  • 2,594
  • 5
  • 30
  • 43
  • On Linux, it works for me with `countries <- readOGR("https://raw.githubusercontent.com/datasets/geo-boundaries-world-110m/master/countries.geojson", "OGRGeoJSON")`. Note that you forgot a `-` between `geo` and `boundaries` in the address. –  Nov 03 '15 at 12:02
  • Also, what is the output of `drv <- ogrDrivers(); drv[drv$name == "GeoJSON",]`? –  Nov 03 '15 at 12:19
  • Thanks Pascal. I did have the ` - ` in the program, just missed it in the copy. Anyway, the `drv`... command gives me `12 GeoJSON TRUE` so I'm not sure that's much help. Any other drivers I should check on? I reinstalled the rgdal package too, thinking that might be the problem. Somewhat baffled. Thanks for the help. – seth127 Nov 04 '15 at 02:09
  • It was to check whether the GeoJSON driver is available, which seems to be the case. I don't see the reason for you to not be able to read the data, as it works for me. –  Nov 04 '15 at 02:15

0 Answers0