[R-sig-Geo] Issue with ogrInfo
Éder Comunello
comunello.eder at gmail.com
Fri May 15 13:41:57 CEST 2015
Hello,
I think the problem is that your link is recovering only html code from
github site. It's necessary to modify it to get the "real" JSON file.
### <code r>
sapply(c("rgeos", "maptools", "rgdal"), require, char=T)
url0 <- "
https://github.com/kjhealy/uk-elections/blob/master/maps/topo_wpc.json"
download.file(url0, dest=basename(url0), mode="wb")
# downloaded 26 KB
uk.map <- readOGR(basename(url0), "wpc")
# Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv
= use_iconv, :
# Cannot open file
url1 <- "
https://raw.githubusercontent.com/kjhealy/uk-elections/master/maps/topo_wpc.json
"
download.file(url1, dest=basename(url0), mode="wb")
# downloaded 2.3 MB
uk.map <- readOGR(basename(url1), "wpc")
# OGR data source with driver: GeoJSON
# Source: "topo_wpc.json", layer: "wpc"
# with 632 features
# It has 2 fields
plot(uk.map)
### </code>
Éder Comunello <c <comunello.eder at gmail.com>omunello.eder at gmail.com>
Dourados, MS - [22 16.5'S, 54 49'W]
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list