# Re: [R] sp: proj4string has no impact

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Wed 17 Jan 2007 - 18:56:00 GMT

On Wed, 17 Jan 2007, Albrecht Kauffmann wrote:

> Hi all,
>
> I'm faced with a problem applying the sp package: The projection argument in
>
>
> e.g.: CRS("+proj=aea +lat_1=46 +lat_2=73 +lat_0=60 +lon_0=84 +x_0=0
> +y_0=0 +ellps=clrk66 +units=m +no_defs")
>
> doesn't have any impact on the plotted object. I also tested the simple
> example:
>
> xy = cbind(x = 2 * runif(100) - 1, y = 2 * runif(100) - 1)
> plot(SpatialPoints(xy, proj4string =
> CRS("+proj=longlat")),xlim=c(-1,1),ylim=c(-1,1))
>
> looks exactly like
>
> plot(SpatialPoints(xy, proj4string =CRS("+proj=stere +lon_0=98 +over"))
>
> or
>
> plot(SpatialPoints(xy))
>
> without any projection.
>
> What I'm doing wrong?

What impact would you like? The vertical scaling adjustment for geographical coordinates ("+proj=longlat") is proportional to the distance of the midpoint of ylim from the Equator, so in your case no adjustment would be expected:

library(sp)
set.seed(1)

```x <- runif(20, -10, 10)
y <- runif(20, -10, 10)
par(mfrow=c(3,2))
```

plot(SpatialPoints(cbind(x, y)), axes=TRUE) plot(SpatialPoints(cbind(x, y), proj4string=CRS("+proj=longlat")), axes=TRUE)
plot(SpatialPoints(cbind(x, y+50)), axes=TRUE) plot(SpatialPoints(cbind(x, y+50), proj4string=CRS("+proj=longlat")),   axes=TRUE)
plot(SpatialPoints(cbind(x, y+70)), axes=TRUE) plot(SpatialPoints(cbind(x, y+70), proj4string=CRS("+proj=longlat")),   axes=TRUE)
par(mfrow=c(1,1))

>
>
> With many thanks for any hint,
>
> Albrecht Kauffmann
> Potsdam University
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.
>

```--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help