[R-sig-Geo] Issue with ogrInfo

Roger Bivand Roger.Bivand at nhh.no
Sun May 10 17:58:18 CEST 2015


On Sun, 10 May 2015, Daniel Marcelino wrote:

> Dear all, I'm having the following issue when trying to read a
> topographical json file:

The file is not recognised by OGR either, so is probably not conforming to 
geojson expectations. It declares itself as HTML, but within github puts 
boundaries on a map background, so I think the file is trying to do much 
more than simply represent Welsh parliamentary constituencies.

Roger

> The file is here
> https://github.com/kjhealy/uk-elections/blob/master/maps/topo_wpc.json
>
>> uk.map <- readOGR(dsn = "maps/topo_wpc.json", layer = "wpc")
> Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding,
> use_iconv = use_iconv,  :
>  Cannot open file
>
>> traceback()
> 5: .Call("ogrInfo", as.character(dsn), as.character(layer), PACKAGE = "rgdal")
> 4: ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,
>       swapAxisOrder = swapAxisOrder, require_geomType = require_geomType)
> 3: withCallingHandlers(expr, message = function(c)
> invokeRestart("muffleMessage"))
> 2: suppressMessages(ogr_info <- ogrInfo(dsn = dsn, layer = layer,
>       encoding = encoding, use_iconv = use_iconv, swapAxisOrder =
> swapAxisOrder,
>       require_geomType = require_geomType))
> 1: readOGR(dsn = "maps/topo_wpc.json", layer = "wpc")
>
>
>> sessionInfo()
> R version 3.2.0 Patched (2015-04-19 r68207)
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
> Running under: OS X 10.8.5 (Mountain Lion)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] rgdal_0.9-2 sp_1.1-0
>
> loaded via a namespace (and not attached):
> [1] MASS_7.3-40      colorspace_1.2-6 scales_0.2.4     plyr_1.8.1
> [5] tools_3.2.0      gtable_0.1.2     reshape2_1.4.1   Rcpp_0.11.5
> [9] ggplot2_1.0.1    grid_3.2.0       stringr_0.6.2    digest_0.6.8
> [13] proto_0.3-10     munsell_0.4.2    lattice_0.20-31
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list