An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20071209/b27d4da1/attachment.pl>
Am i misusing the shift() option in elide(maptools) function?
4 messages · zhijie zhang, Roger Bivand
On Sun, 9 Dec 2007, zhijie zhang wrote:
Dear friends,
I used the shift() option in elide(maptools) function to shift the x/y
coordiates, but it seemed that it didn't change the coordinates.
#Programs used by me
library(sp)
library(foreign)
library(maptools)
data(meuse) #in the help page
coordinates(meuse) <- c("x", "y")
proj4string(meuse) <- CRS("+init=epsg:28992")
data(meuse.riv)
river_polygon <- Polygons(list(Polygon(meuse.riv)), ID="meuse")
rivers <- SpatialPolygons(list(river_polygon))
proj4string(rivers) <- CRS("+init=epsg:28992")
#rivers
Slot "coords":
[176,] 182003.7 337678.6
Slot "bbox":
min max
r1 178304.0 182331.5
r2 325698.5 337684.8
rivers1 <- elide(rivers, shift=c(10000,-10000)) #,shift southeast to 10000,
but it seems unchanged
#rivers1
#the coordinates were the same as that of rivers
Slot "coords":
[176,] 182003.7 337678.6
Slot "bbox":
min max
r1 178304.0 182331.5
r2 325698.5 337684.8
Q: Am i misusing the shift() option in elide(maptools) function? Where goes
wrong?
Thanks for a very clear report, this was a bug. The shift= argument worked for points but not for lines or polygons. The next release of maptools will correct this, and add rotation options kindly contributed by Don MacQueen. Roger
Thanks.
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, 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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20071210/5272a6d5/attachment.pl>
On Mon, 10 Dec 2007, zhijie zhang wrote:
Let me know if the new version of maptools was available. I was waiting to use it.
The 0.7-2 source is on CRAN and will move to mirrors when they update. Neither Windows nor OSX binaries have updated on CRAN yet, but should do so during 10 December (CET and EST I think). A word of thanks to Kurt Hornik at CRAN, who with helpers not only publishes all the 1000+ packages on CRAN, but also checks them first across a range of platforms. The speed of response of the CRAN team is one of the reasons for making it easy for package maintainers to deal with bugs quickly. Thanks also to Uwe Ligges for the Windows binary package builds, and to Simon Urbanek for the very complicated OSX binary package builds. Roger
Thanks. On Dec 10, 2007 1:34 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
On Sun, 9 Dec 2007, zhijie zhang wrote:
Dear friends,
I used the shift() option in elide(maptools) function to shift the x/y
coordiates, but it seemed that it didn't change the coordinates.
#Programs used by me
library(sp)
library(foreign)
library(maptools)
data(meuse) #in the help page
coordinates(meuse) <- c("x", "y")
proj4string(meuse) <- CRS("+init=epsg:28992")
data(meuse.riv)
river_polygon <- Polygons(list(Polygon(meuse.riv)), ID="meuse")
rivers <- SpatialPolygons(list(river_polygon))
proj4string(rivers) <- CRS("+init=epsg:28992")
#rivers
Slot "coords":
[176,] 182003.7 337678.6
Slot "bbox":
min max
r1 178304.0 182331.5
r2 325698.5 337684.8
rivers1 <- elide(rivers, shift=c(10000,-10000)) #,shift southeast to
10000,
but it seems unchanged
#rivers1
#the coordinates were the same as that of rivers
Slot "coords":
[176,] 182003.7 337678.6
Slot "bbox":
min max
r1 178304.0 182331.5
r2 325698.5 337684.8
Q: Am i misusing the shift() option in elide(maptools) function? Where
goes
wrong?
Thanks for a very clear report, this was a bug. The shift= argument worked for points but not for lines or polygons. The next release of maptools will correct this, and add rotation options kindly contributed by Don MacQueen. Roger
Thanks.
-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, 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
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, 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