[R-sig-Geo] Help with GeoRSS
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Mon May 9 00:41:39 CEST 2011
On Sun, May 8, 2011 at 8:43 PM, Michael Denslow
<michael.denslow at gmail.com> wrote:
> Hello Everyone,
>
> I am trying to read a GeoRSS file using library rgdal and can't seem
> to get it to work. I suspect that it is because I am not specifying
> the layer = argument correctly (or the dsn). Am I missing something
> obvious? I am not clear what goes into this argument for this type of
> file.
>
> Some sample code:
>
> library(rgdal)
> # says GeoRSS TRUE
> ogrDrivers()
> getGDALVersionInfo()
> # [1] "GDAL 1.8.0, released 2011/01/12"
>
> # ERROR says 'GDAL Error 4: Failed to read GeoJSON data'
> ogrInfo(dsn='http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M5.xml',
> layer = 'USGS M 5+ Earthquakes')
>
>
> Additionally, I am not sure why GDAL thinks the file is a GeoJSON. I also tried:
>
> # OGRGeoJSON is apparently the predefined layer name
> ogrInfo(dsn='http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M5.xml',
> layer = 'OGRGeoJSON')
>
My rgdal doesnt have geoRSS, but my command line ogrinfo says there's
one layer in the file, called 'georss', and if I get that layer info
it seems to work (note I've downloaded the XML file to my working
directory - maybe this fails as a URL...):
$ ogrinfo eqs7day-M5.xml
Had to open data source read-only.
INFO: Open of `eqs7day-M5.xml'
using driver `GeoRSS' successful.
1: georss (Point)
$ ogrinfo eqs7day-M5.xml georss
Had to open data source read-only.
INFO: Open of `eqs7day-M5.xml'
using driver `GeoRSS' successful.
Layer name: georss
Geometry: Point
Feature Count: 35
[here come the features]
So try layer="georss" in your ogrInfo (and hence readOGR) call...
Barry
More information about the R-sig-Geo
mailing list