[R-sig-Geo] tooltips or annotation
Roger Bivand
Roger.Bivand at nhh.no
Tue Jun 16 16:28:44 CEST 2015
On Tue, 16 Jun 2015, Erich Subscriptions wrote:
> I just tried the same test on Ubuntu with all the latest packages and
> had the same problem.
>
> writeOGR does not work for GeoJSON
Yes it does, just read the driver page on OGR/GDAL:
http://www.gdal.org/drv_geojson.html
For GDAL 2.0.0RC2:
writeOGR(cities, paste(td, ".geojson", sep="/"), "OGRGeoJSON",
driver="GeoJSON")
writeOGR(cities, paste(td, "cities.geojson", sep="/"), "OGRGeoJSON",
driver="GeoJSON")
writeOGR(cities, paste(td, "cities.geojson", sep="/"), "cities",
driver="GeoJSON")
all work (the file name extension in the dsn= argument matters); note
that only:
writeOGR(cities, paste(td, ".geojson", sep="/"), "OGRGeoJSON",
driver="GeoJSON")
works in GDAL 1.11.2.
So until you have GDAL 2, the file name must be ".geojson" (nothing before
the dot), and probably the layer name must be "OGRGeoJSON".
Roger
>
> cities <- readOGR(system.file("vectors", package = "rgdal")[1], "cities")
> is.na(cities$POPULATION) <- cities$POPULATION == -99
> summary(cities$POPULATION)
> td <- "."
> writeOGR(cities, td, "cities", driver="ESRI Shapefile") # this works
> writeOGR(cities, td, "cities", driver="GeoJSON") # this fails
>
> _______________________________________________
> 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