[R-sig-Geo] "Geographical CRS given to non-conformant data" for CRS of epsg:4326

Roger Bivand Roger.Bivand at nhh.no
Fri Dec 16 19:04:27 CET 2011


On Fri, 16 Dec 2011, Robert J. Hijmans wrote:

> Agus,
>
> This is likely because there are some longitude coordinates that are  <
> -180 or > 180.
> OGR does not complain, but, as these are lon/lat data, sp runs
> sp:::.ll_sanity  and throws an error.
>
> I think it would be preferable if sp gave a warning rather than an error,
> at least when longitudes are within a reasonable number (-360 -- 360 ?). I
> think that a longitude of, e.g. 181 is perfectly interpretable, and
> sometimes useful. For example to plot Russia, or Fiji in one piece in
> lon/lat coordinates.

As Agus knows, unless the file is made available, help will likely not be 
forthcoming. Without a traceback(), we don't know where the error is being 
thrown. The fact that an out of domain number is interpretable in one 
context doesn't necessarily make it acceptable in others, I believe. We 
could go to an option setting, which would slacken the error to a warning 
if set. Opinions?

Roger

>
> Robert
>
>
> On Fri, Dec 16, 2011 at 4:24 AM, Agustin Lobo <alobolistas at gmail.com> wrote:
>
>> Hi!
>> I' trying to read this shapefile that is just in lon,lat WGS84
>>> ogrInfo(dsn=datad,layer="world_adm0v2")
>> Source: "/media/Iomega_HDD/JACOB/ExIE2011DATA/ExFireBorneoDATA/world_adm0",
>> layer: "world_adm0v2"
>> Driver: ESRI Shapefile number of rows 209
>> Feature type: wkbPolygon with 2 dimensions
>> +proj=longlat +datum=WGS84 +no_defs
>> Number of fields: 3
>>       name type length typeName
>> 1      NAME    4     40   String
>> 2 GMI_CNTRY    4      3   String
>> 3    REGION    4     25   String
>>
>> but I get:
>>> world <-readOGR(dsn=datad,layer="world_adm0v2")
>> OGR data source with driver: ESRI Shapefile
>> Source: "/media/Iomega_HDD/JACOB/ExIE2011DATA/ExFireBorneoDATA/world_adm0",
>> layer: "world_adm0v2"
>> with 209 features and 3 fields
>> Feature type: wkbPolygon with 2 dimensions
>> Error in validityMethod(as(object, superClass)) :
>>  Geographical CRS given to non-conformant data
>> I've tried
>>> world
>> <-readOGR(dsn=datad,layer="world_adm0v2",p4s=CRSargs(CRS("+init=epsg:4326")))
>> but get the same result
>>
>> can't this CRS (epsg:4326)
>> +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
>> be read by readOGR() ?
>>
>> Thanks
>> Agus
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> 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, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list