[R-sig-Geo] coordinate precision using rgdal [solved]

Dylan Beaudette dylan.beaudette at gmail.com
Fri Oct 26 21:48:32 CEST 2007


On Friday 26 October 2007, Roger Bivand wrote:
> On Fri, 26 Oct 2007, Dylan Beaudette wrote:
> > On Friday 26 October 2007, Roger Bivand wrote:
> >> On Fri, 26 Oct 2007, Dylan Beaudette wrote:
> >>> Hi,
> >>>
> >>> noticed that when I import a shapefil with readOGR()  the coordinates
> >>> are truncated to integers. Is there some way to prevent this type of
> >>> behaviour?
> >>

As usualy Roger saved the day.

The print method for an sp object will only print integer coordinates, even 
though they are stored as double precision internally. 

for an object called 'x' read in via readOGR()

print(coordinates(x)[1:5,], digits=15)

        coords.x1  coords.x2
[1,] 6615306.65 1959209.25
[2,] 6629710.25 1955324.95
[3,] 6623808.65 1953662.05
[4,] 6628580.05 1950899.85
[5,] 6633176.65 1950432.55

... look good!

Thanks Roger.


-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341




More information about the R-sig-Geo mailing list